Setting players death spawn (World spawn)

Discussion in 'Plugin Development' started by Xyplo, Apr 14, 2014.

Thread Status:
Not open for further replies.
  1. Offline


    So I need help on setting the worlds death spawn which is also known as the world spawn. It's the spawn you're teleported to when you die. I spawn randomly which I do not want. So how would I set the world spawn in coding? On the first join, the player spawns in the correct place, but once they die they do not. Help?

    BTW: I am NOT using Essentials as my server only has plugins coded by me; with an exception of a few plugins. So PLEASE do not reply with essentials related replies as they will not help.

    -Thanks, Xyplo.
  2. Offline


    This is a pretty simple way of doing it:

    1. //Event will be called when player hits the "Respawn" button
    2. @EventHandler
    3. public void onrespawn(PlayerRespawnEvent event){
    4. //Get's the current world
    5. World world = Bukkit.getWorld("world");
    6. //Set in the Coordinates for X - Y - Z
    7. Location newspawn = new Location(world, x, y, z);
    9. //Teleport the player to the set location
    10. event.setRespawnLocation(lobbyspawn);
    11. }
  3. Offline


    Changed it from
    1. event.setRespawnLocation(lobbyspawn);
    1. e.setRespawnLocation(newspawn);
    and it worked fine! Thanks XD
Thread Status:
Not open for further replies.

Share This Page