[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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    And whats about replacing the normal /spawn with an Teleportation with Y X and Z axes?
     
  5. Offline

    Plague

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Sure, but what for? Normal players will still be on the real spawnpoint not the one given by /spawn.
     
  6. Offline

    GhandPivot

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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

    My BukkitDev Profile
    My Plugins (1)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Wouldn't be that bad, just something like: (roughly done, but it should work?)

    Code (Text):
    1.  
    2. World world = player.getWorld();
    3. Location spawnLocation = world.getSpawnLocation();
    4. boolean found = true;
    5.  
    6. /* For some reason the real spawn will get us stuck */
    7. if(!isValid(world, spawnLocation))
    8. {
    9.     int spawnX = spawnLocation.getBlockX();
    10.     int spawnZ = spawnLocation.getBlockZ();
    11.    
    12.     /* Start at the height where the spawn is and iterate upwards */
    13.     int height = spawnLocation.getBlockY();
    14.    
    15.     found = false;
    16.    
    17.     /* Search for a suitable location, since it recurses upwards it's */
    18.     /* easy to assume they'll land safely without dying (Unless it's lava, haha) */
    19.     while(height < 128)
    20.     {
    21.         Block start = world.getBlockAt(spawnX, height, spawnZ);
    22.        
    23.         if(isValid(world, start))
    24.         {
    25.             /* We found a match! */
    26.             spawnLocation = start;
    27.             found = true;
    28.             break;
    29.         }
    30.        
    31.         height ++;
    32.     }
    33. }
    34.  
    35. if(found)
    36. {
    37.     player.teleportTo(spawnLocation);
    38. }
    39. else
    40. {
    41.     player.sendMessage("No suitable spawn point found");
    42. }
    43.  
    44. /* Perhaps check if it's water as well, since water is relatively safe */
    45. public boolean isValid(World world, Block block)
    46. {
    47.     /* If the block isn't air, forget it because it's not valid either way */
    48.     if(block.getType() != Material.AIR)
    49.     {
    50.         return false;
    51.     }
    52.    
    53.     /* Check the block above it */
    54.     Block above = world.getBlockAt(block.getX(), block.getY() + 1, block.getZ());
    55.    
    56.     if(above != null && above.getType() == Material.AIR)
    57.     {
    58.         /* All good! Both are air */
    59.         return true;
    60.     }
    61.    
    62.     return false;
    63. }
    64.  
     
  9. Offline

    Plague

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Was hoping for some bukkit function instead of just testing the blocks manually :)
     
  10. Offline

    mhom

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    That's how minecraft works. When you are killed you spawn in a random location around the spawn point.
     
  12. Offline

    mhom

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Oh. I always thought it was one exact spot.
     
  13. Offline

    Mark

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Thanks =D

    Kris
     
  16. Offline

    Duccis

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    connection timed out. can't download ಠ_ಠ
     
  18. Offline

    Plague

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Server downtime for an hour or so.
    --- merged: Feb 10, 2011 10:25 PM ---
    OK, updated.
     
  19. Offline

    Duccis

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Awesome! Thanks a lot. Will test it later. Cheers.
     
  20. Offline

    Moo Master

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    The latest version does spawn at x+0.5, y, z+0.5 ...
     
  22. Offline

    Moo Master

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    oooh, time to update thanks!
     
  23. Offline

    Duccis

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Aww, shame. Will try to find another solution for my problem then. Thanks for the reply 'tho.
     
  26. Offline

    27ace27

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    is there any way of setting what world you spawn in when you first join?
     
  27. Offline

    Plague

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Could you add some config file or something so you can configure that only ops can do /setspawn AND /spawn
     
  29. Offline

    Plague

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    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