is it possible to remove the death screen entirely?

Discussion in 'Plugin Development' started by frozenpoptartmc, Jan 19, 2013.

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

    frozenpoptartmc

    like an auto-respawn?
    i haven't messed around with the playerdeathevent much so i have no idea
     
  2. Offline

    Jogy34

    I don't think so as I believe that is handled client side but what you could do is get every time a player is damaged and if the damage is greater than the player's health then you cancel the even and fake a death.
     
    frozenpoptartmc likes this.
  3. Offline

    valon750

    I suppose you could.. technically find a way of just teleporting the player to the spawn point with full health when their health reaches say, 1.
     
    frozenpoptartmc likes this.
  4. Offline

    frozenpoptartmc

    yeah i figured there wasn't a way to remove it anyway

    thanks for the help!
     
  5. Offline

    theearlypc423

    No it's partially client side. Not just client the servers count the death time.
     
  6. Offline

    ImDeJay

    all you have to do is on playerdeathevent, just cancel the event then set the players health to 20 and send them to the spawn location.

    just bypass the death screen all together.

    frozenpoptartmc
     
  7. Offline

    Jogy34

    The PlayerDeathEvent isn't cancelable.

    andrewyunt

    I was referring to the actual death screen being client side not the player dying.
     
  8. Offline

    chasechocolate

  9. Offline

    gyroninja

    Or be cheaty and on player death set his health to 20 and then teleport him to spawn. Setting their health above 0 removes the town button.
     
    BH72 likes this.
  10. Offline

    d33k40

    That method will break some plugins, statistics, because player never die.
     
  11. Offline

    Jogy34

    The death screen will still appear as the player's health reached 0. The player would have to log off then log back on to get rid of the death screen if they didn't hit the respawn button.
     
  12. Offline

    Comphenix

    It is, you just have to wait a bit more than 6 minutes for people to respond to your question ...

    So, chasechocolate pretty much gave you the answer. You have to emulate a "client command" packet with some CraftBukkit trickery. Or, since I always have to mention it, you can use ProtocolLib:
    Code:java
    1. public class ExampleMod extends JavaPlugin implements Listener {
    2. private ProtocolManager manager;
    3.  
    4. @Override
    5. public void onEnable() {
    6. getServer().getPluginManager().registerEvents(this, this);
    7. manager = ProtocolLibrary.getProtocolManager();
    8. }
    9.  
    10. @EventHandler
    11. public void onPlayerDeath(final PlayerDeathEvent event) {
    12. getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
    13. @Override
    14. public void run() {
    15. try {
    16. // Press the respawn button for the player
    17. PacketCDClientStatuses respawn = new PacketCDClientStatuses();
    18.  
    19. respawn.setPayload(Payloads.RESPAWN_AFTER_DEATH);
    20. manager.recieveClientPacket(event.getEntity(), respawn.getHandle());
    21. } catch (Exception e) {
    22. e.printStackTrace();
    23. }
    24. }
    25. }, 10);
    26. }
    27. }
     
  13. Offline

    Zimbaway

    There is a way. Create a handled PlayerDeathEvent and when they die set their health to 20 and respawn them.
     
  14. Offline

    Comphenix

    I see a lot of people don't actually try their suggestions before they post them ...

    No, this doesn't remove the death screen. Not does it work well with other plugin events. Just send the Packet250ClientCommand packet instead - it works flawlessly.
     
  15. Offline

    EnvisionRed

    Handle a PlayerDamageEvent, if the player's hp - event damage is less than 0: cancel the damage event, set the player's hp to max, tp to spawn, and create a PlayerDeathEvent to be handled?
     
  16. Offline

    Comphenix

    Never mind correctly resetting the player state invoking the right events - just determining whether or not a damage event will kill a player is exceedingly complex.

    So ... it's probably not the way to go. :p
     
  17. I don't get it. Why do people keep repeating the same things over and over again, even after they have been invalidated?
    In another thread, that is even already linked here, I explained in great detail what is wrong with "cancel damage, reset health, teleport to spawn":
    I posted a working, flawless solution that has even already been picked up by Comphenix in this thread.

    So please stop suggesting the same broken method that was addressed multiple times ...
     
    tommycake50 and Comphenix like this.
  18. Offline

    Zimbaway

    It does work, ive tried it :D
     
  19. Offline

    Comphenix

    I gave your suggestion a go, but it didn't correctly reset the player in my case. You get stuck on the death screen, which can only be removed by relogging.

    I don't claim that your method is impossible in principle - just that what you described didn't produce the desired results. If you have a working code example, feel free to post it.
     
Thread Status:
Not open for further replies.

Share This Page