Solved Different Respawn Locations on Death

Discussion in 'Plugin Development' started by KeybordPiano459, Dec 24, 2012.

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

    KeybordPiano459

    Is there a better way to have players respawn at different points based on permissions? With this code, you see that you were teleported before you die.
    Code:java
    1. @EventHandler
    2. public void onDeath(PlayerDeathEvent event) {
    3. Player player = event.getEntity();
    4. if (player.hasPermission("myplugin.perm")) {
    5. player.teleport(new Location(world, 1, 1, 1));
    6. } else if (player.hasPermission("myplugin.otherperm")) {
    7. player.teleport(new Location(world, 2, 2, 2));
    8. } else {
    9. player.teleport(new Location(world, 3, 3, 3));
    10. }
    11. }
     
  2. almost correct. but you need to do it when the player respawn, but do a delayed task with like 1 tick. then it should work.
     
  3. Offline

    Ne0nx3r0

  4. if you do that you set the new respawn for all players.
    do it the way you did, with the ifs and teleport 1 tick after respawn. it works.
     
  5. Offline

    Ne0nx3r0

    Oh does it really? I didn't realize that. Hrm.
     
  6. Offline

    KeybordPiano459

    mollekake
    Ne0nx3r0
    The scheduler thing ended up not working, and I was able to configure PlayerRespawnEvent to what I needed. Thanks :)
     
  7. Offline

    fireblast709

    mollekake @Ne0nx3ro No setRespawnLocation is only for that event
     
    Ne0nx3r0 likes this.
  8. Offline

    Ne0nx3r0

    That's what I thought, but the javadocs were (as per usual) very vague about it, and I don't have practical experience with the event.
     
  9. Offline

    fireblast709

    I can tell you from experience that it works as we both think ;3
     
  10. weird, didn't work for me. oh well.
     
  11. Offline

    fireblast709

    It might be that other plugins overrode your spawnpoint ;3
     
  12. no it was a plugin made from scratch. but i use the tp after respawn, like it better.
     
  13. Offline

    fireblast709

    I mean other plugins on the server ;3. Besides, teleportation after respawn would just mean more methods to call ;3 (and less efficient)
     
  14. not sure which one is more efficient, setting respawn after each death or tp after each respawn. besides, i test my plugins alone localy with no other plugins ofcourse.
     
  15. Offline

    fireblast709

    Setting the spawn would mean one teleport, teleporting a player 1 tick afterwards means they teleport to spawn and 1 tick later teleport to the location, aka 2 teleports ;3
     
  16. Offline

    RaininSwords

    @fireblast709
    @mollekake
    @Ne0nx3r0

    So I was wondering if there is a way to set a spawn point to a sign, i know this thread is really old and all but im curious and u guys seem smart. So, im assuming you guys have heard of the ships plugin and movecraft. I was wondering if there was a way to set a players respawn to a sign, not the coordinates of the sign, but the sign itself. So. when a player gets killed on their ship they will be sent back onto it when they respawn or when they do something like /tphome, /home, or /shiphome. This may a little difficult but im kinda new to bukkit events and all, i have had a server for pretty long and this would a be an awesome feature that im sure a lot of other server would like. If it is possible either reply on this or just pm me. thanks once more!

    ~Rainin
     
Thread Status:
Not open for further replies.

Share This Page