Solved Bypassing Death Screen?

Discussion in 'Spigot Plugin Development' started by fujiboy4, Jun 5, 2020.

Thread Status:
Not open for further replies.
  1. Hello, after about 3 hours of researching 1.15.2's current API for DeathEvent related material, I have found no solution for this. I wish to bypass the death screen when a player dies and then set their health to 20. This is my current attempt and I will show what I have previously done. None of these methods have worked. If anyone has any solutions, please let me know.

    First Attempt:
    Code (Java):
    player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
    player.spigot().respawn();
    ...
    Second Attempt:
    Code (Java):
    player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
    new BukkitRunnable() {
                    @Override
                    public void run() {
                        player.spigot().respawn();
                    }
    }.runTaskLater(JavaPlugin.getPlugin(Main.class), 1L);
    ...
    This is the result every test:[​IMG] https://ibb.co/5GNym7d

    Please let me know if you can help. Thanks!
     
  2. If you're just searching a way to bypass that, look into doImmediateRespawn gamerule.
     
    • Like Like x 1
  3. Flip the respawn call and the setHealth call in the first attempt, it looks like you may be doing it out of order
     
  4. Will look into both of these tomorrow, thank you!
     
  5. This worked. Thank you both.
     
Thread Status:
Not open for further replies.