Recommended Plugin to Spawn Players Always on Spawn Point

Discussion in 'Server & Community Management' started by faztriotzz, Aug 7, 2013.

  1. hello,
    is there a plugin to force a players spawn location, regardless of where they logged out from?
     
  2. joehot200

    Supporter

    That would be incredibly easy to code :)
     
  3. joehot200

    Supporter

    Premium server:
    Code (Java):

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event){
    Player p = event.getPlayer();
    p.teleport(p.getWorld().getSpawnLocation());
     
     
    }
     
     
    Cracked server: (Will only work if you have location protect on where it forces them to go to spawn until logged in)
    Code (Java):

    @EventHandler
    public void onTP(PlayerTeleportEvent event){
    Player p = event.getPlayer();
    Location from = event.getFrom();
    if (from.distance(from.getWorld().getSpawnLocation()) <= 10){
     
     
    p.teleport(p.getWorld().getSpawnLocation());
    }
     
     
    }
     
     
    • Disagree Disagree x 1
  4. thankss but i have no clu what to do whit it, im not that in to coding :p
     
  5. joehot200

    Supporter

    Ill compile it into a jar and send it to you. Are you a premium or a cracked server?
     
  6. PhanaticD

    Patron

    if u have essentials plugin its just a config option
     
    • Agree Agree x 1
  7. whats the diffrents, i have a spigot server running om my pc
     
  8. joehot200

    Supporter

    Im using an old version as my server is still 1.5.2, didnt know :(
     
  9. whats the problem than?
     
  10. can u please help me i have lookt up how to make a plugin but i get a error when i load it
     
  11. faztriotzz - I use essentialsspawn. Not sure if its the best, but it works for me.
     
  12. obscurehero i use it 2 but when i spawn i go building on my server, and when i log out i want to respawn on the spawnpoint not where i left off, like hypixel or something there u always spawn on the /setspawn
     
  13. LiLChris

    LiLChris Retired Moderator
    Retired

    • Agree Agree x 1

  14. Hi, do you send me this file compiled? pls

    regards

    P.D. cracked server
     
  15. No DON'T use this, it's not thread safe to teleport players on join. Don't use somebody's code unless you fully understand what it does.
    md_5 says:
    https://forums.bukkit.org/threads/what-to-do-and-what-not-to-do-in-bukkit.112307/

    Also, for the second code snippet
    Code (Text):
    p.teleport(p.getWorld().getSpawnLocation());
    should be replaced with
    Code (Text):
    event.setTo(p.getWorld().getSpawnLocation());
     
    #17 EDawg878, Oct 6, 2013
    Last edited: Oct 6, 2013
    • Winner Winner x 2
  16. joehot200

    Supporter

    I know all that stuff now, i typed that ages ago. It is easy enough to set a delayed task to do it 0.05 seconds later. At the time i did not even know there was a setTo() function.
     
    • Agree Agree x 2