Help with respawn players

Discussion in 'Plugin Development' started by rotan4eg, Oct 25, 2014.

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

    rotan4eg

    Hi friends.

    I want to implement spawn players in certain predetermined locations. Such is, in the plugin MyZ. Tell me how to implement it. Thank you
    Sorry for my English.
     
  2. Offline

    xTrollxDudex

    Teleport them to them when they die.
     
  3. Offline

    superguy9

    Alrighty then, I'm going off on another rant.
    Why are you expecting US community members to make YOUR plugin?
    Also, we need to see your code to even give you any hints. Maybe your almost there, maybe your not.
    Another question, have you looked up tutorials or have you tried doing that already?

    Please edit/remove this thread unless if you plan on making some revisions to this post.
     
    rotan4eg likes this.
  4. Offline

    rotan4eg

    Thanks for the quick response. I just wanted to find out what events and methods are used for this purpose.
     
  5. Offline

    acer5999

    Unless it has already been answered by TrollDude, You'll need to use a PlayerRespawnEvent. The pseudo would be something like

    Code:
    player respawns
     
    Get locations, pick random one
    teleport player to location
    
    Hope this helps
     
    rotan4eg likes this.
  6. Offline

    rotan4eg

    Thank you very much)
     
  7. Offline

    sebcio98

    You can't teleport dead players. When the PlayerRespawnEvent is called the player is still dead. You have to do something like this:
    Code:java
    1. new BukkitRunnable()
    2. {
    3. @Override
    4. public void run()
    5. {
    6. Player p = e.getPlayer();
    7. p.teleport(POSITION);
    8. }
    9. }.runTaskLater(this, 1L);


    I haven't tested it so don't blame me if I made a mistake here. I'm not sure about "this" in last line.

    Hope it helped.
     
    rotan4eg likes this.
Thread Status:
Not open for further replies.

Share This Page