Solved Auto respawn works fine except player looks dead

Discussion in 'Plugin Development' started by vtg_the_kid, Aug 2, 2014.

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

    vtg_the_kid

    I'm trying to skip the respawn screen when a player dies, heres the code so far.
    Code:java
    1. @EventHandler
    2. public void autoRespawn(PlayerDeathEvent event) {
    3. final Player player = event.getEntity();
    4. Bukkit.getScheduler().scheduleSyncDelayedTask(dk, new Runnable() {
    5. public void run() {
    6. if (player.isDead()) {
    7. player.setHealth(20);
    8. player.teleport(dk.spawn);
    9. player.setFireTicks(0);
    10. dk.safe.add(player);
    11. }
    12. }
    13. });
    14. }

    It works great, except for two things.

    1. When player dies in lava, it displays the respawn title, but it does teleport the player to spawn.
    2. When a player dies and respawns the player looks like this:
    [​IMG]
    If you could help me solve these problems, it would be great!
    Thank you guys so much!
     
  2. Offline

    The Fancy Whale

    Lol thats kind of a cool thing that you can make bodies like that. But in your method you actually have to add a delay to the task :p
     
  3. Offline

    Shevchik

    You should do this in player death event. Not a tick after.
     
    vtg_the_kid likes this.
  4. Offline

    vtg_the_kid

    Can someone who understands what I'm trying to do help me :(
    The Fancy Whale
    How does adding a delay help me skip the respawn screen at all? I actually tried adding a delay and it made the respawn screen appear every single time, instead of just sometimes.
    Shevchik
    When I got rid of the runnable thing, it didn't teleport me back to spawn :(

    Can someone else help me with the dead body thing, I wanna get rid of it!

    Nevermind you're a beast from the east, it worked

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
Thread Status:
Not open for further replies.

Share This Page