[ADMN] PlgSetspawn v5.0 - /setspawn and /spawn for OPs [1.4]

Discussion in 'Archived: Plugin Releases' started by Plague, Jan 30, 2011.

  1. Offline

    Plague

    PlgSetspawn - Plugin for /setspawn and /spawn only:
    Version: v5.0

    This plugin just gives /setspawn to OPs and /spawn to all, nothing more nothing less.
    It uses bukkit internal permission system.
    As in all my plugins, you can now edit the name of commands in plugin.yml.

    Permissions:
    • plgsetspawn.spawn for /spawn command (default all)
    • plgsetspawn.setspawn for /setspawn command (default op)

    Download(source inside)

    [​IMG]

    Changelog:
    Version 5.0:
    • Added bukkit permissions (spawn for all, setspawn for OPs by default)
    • Thanks @McAndze for showing me how to implement them easily :)
    Version 4.1
    • updated internals, should work on every MC build supported by bukkit now
    Version 4.0
    • uses onComand - CB 454+ compatible
    • you can now edit plugin.yml and change command names via "aliases:"
    Version 3.0
    • Updated for Minecraft 1.3 and craftbukkit 432
    Version 2.1
    • /spawn for everyone, /setspawn for OPs
    Version 2.0
    • updated craftbukkit API
    • you now /spawn on the exact location even if there are blocks above
    Version 1.0
    • Initial release
     
  2. Offline

    PcWingman

    ummm one thing i cant spawn inside of buildings.ive made this spawn building and when u try to use /spawn u got to the roof. It might be something interferring with the plugin idk. just wandering if u kno whats wrong?
     
  3. Offline

    Plague

    This is how minecraft works. If you get killed you spawn always at the top of all blocks, to prevend spawning in a mountain or something.
     
  4. Offline

    Seta

    And whats about replacing the normal /spawn with an Teleportation with Y X and Z axes?
     
  5. Offline

    Plague

    Sure, but what for? Normal players will still be on the real spawnpoint not the one given by /spawn.
     
  6. Offline

    GhandPivot

    well there's plugins like exactspawn which gives you the ability to fully choose on which block you want to spawn even if there's blocks above you...
     
  7. Offline

    Plague

    Yeah, but it does not use the vanilla spawn system, for which this plugin is intended.
    --- merged: Feb 3, 2011 10:19 PM ---
    Okay, since craftbukkit changed the interface for spawn position, you now DO set spawn to exact position and will spawn there. I have NOT added any code to protect you from spawning inside a block however! Spawn protection should make that impossible anyway.

    If anybody would code that I will add it to the source...
     
  8. Offline

    Hidendra

    Wouldn't be that bad, just something like: (roughly done, but it should work?)

    Code:
    World world = player.getWorld();
    Location spawnLocation = world.getSpawnLocation();
    boolean found = true;
    
    /* For some reason the real spawn will get us stuck */
    if(!isValid(world, spawnLocation))
    {
    	int spawnX = spawnLocation.getBlockX();
    	int spawnZ = spawnLocation.getBlockZ();
    	
    	/* Start at the height where the spawn is and iterate upwards */
    	int height = spawnLocation.getBlockY();
    	
    	found = false;
    	
    	/* Search for a suitable location, since it recurses upwards it's */
    	/* easy to assume they'll land safely without dying (Unless it's lava, haha) */
    	while(height < 128)
    	{
    		Block start = world.getBlockAt(spawnX, height, spawnZ);
    		
    		if(isValid(world, start))
    		{
    			/* We found a match! */
    			spawnLocation = start;
    			found = true;
    			break;
    		}
    		
    		height ++;
    	}
    }
    
    if(found)
    {
    	player.teleportTo(spawnLocation);
    }
    else
    {
    	player.sendMessage("No suitable spawn point found");
    }
    
    /* Perhaps check if it's water as well, since water is relatively safe */
    public boolean isValid(World world, Block block)
    {
    	/* If the block isn't air, forget it because it's not valid either way */
    	if(block.getType() != Material.AIR)
    	{
    		return false;
    	}
    	
    	/* Check the block above it */
    	Block above = world.getBlockAt(block.getX(), block.getY() + 1, block.getZ());
    	
    	if(above != null && above.getType() == Material.AIR)
    	{
    		/* All good! Both are air */
    		return true;
    	}
    	
    	return false;
    }
    
     
  9. Offline

    Plague

    Was hoping for some bukkit function instead of just testing the blocks manually :)
     
  10. Offline

    mhom

    For me, this mod only allows me to set the /spawn point; not the respawn point. When I respawn, it goes to a random location in the area my new point is at.
     
  11. Offline

    Plague

    That's how minecraft works. When you are killed you spawn in a random location around the spawn point.
     
  12. Offline

    mhom

    Oh. I always thought it was one exact spot.
     
  13. Offline

    Mark

    Is this to set the spawn for the individual who sets it or for all in game. Because I setspawn and everybody spawns there now. With what you said I assumed it would only be me at the new spawn point.
     
  14. Offline

    Plague

    It sets the world spawn point. What I meant was, that after you die you spawn at a random place around it, not like /spawn which is exact.
     
  15. Offline

    KrisEike

    Thanks =D

    Kris
     
  16. Offline

    Duccis

    Really like the minimalistic of this plugin, but would prefer using this with Permission. Or simply make /spawn enable to public while /setspawn is only for OPs.
     
  17. Offline

    txtsd

    connection timed out. can't download ಠ_ಠ
     
  18. Offline

    Plague

    Server downtime for an hour or so.
    --- merged: Feb 10, 2011 10:25 PM ---
    OK, updated.
     
  19. Offline

    Duccis

    Awesome! Thanks a lot. Will test it later. Cheers.
     
  20. Offline

    Moo Master

    This works really well, just some of the posistions are off sometimes, could you possibly make it so it spawns on decimal points not just whole numbers?

    (if its 44x, 57y,-245z, could it be something like 44.546x, 57y,-245.768z?)
     
  21. Offline

    Plague

    The latest version does spawn at x+0.5, y, z+0.5 ...
     
  22. Offline

    Moo Master

    oooh, time to update thanks!
     
  23. Offline

    Duccis

    Works great the latest version! But I noticed that when you join the server for the first time, you actually spawn above the spawnpoint (if it's set underground). Any way to get around that so new players will spawn at the exact spawnpoint? Much appreciated as I'm making an RP server which starts underground.
     
  24. Offline

    Plague

    That's minecraft behavior, this plugin only sets the spawnpoint, but the actual spawning after death (or birth?) is done by minecraft.
     
  25. Offline

    Duccis

    Aww, shame. Will try to find another solution for my problem then. Thanks for the reply 'tho.
     
  26. Offline

    27ace27

    is there any way of setting what world you spawn in when you first join?
     
  27. Offline

    Plague

    I couldn't find a way the world is stored in the spawnpoint I don't think it is because it's a Minecraft hing, bukkit added multiworld by itself...
    --- merged: Feb 23, 2011 8:10 PM ---
    Updated for CB 432. I think it should not spawn you into a bad location on the other world, but setting the location in the other world is still a little bit shady.
     
  28. Offline

    RagingMonocle

    Could you add some config file or something so you can configure that only ops can do /setspawn AND /spawn
     
  29. Offline

    Plague

    My plugins don't use config files, I like them to be this independent. I can however upload a version that allows only ops do /spawn.
    --- merged: Feb 24, 2011 7:02 PM ---
    There.
     
  30. Offline

    RagingMonocle

    Thanks alot, you're the best :)
    --- merged: Feb 24, 2011 9:10 PM ---
    Uhm, the op version doesn't work for me.
    craftbukkit build433
     

Share This Page