Solved Cancell Death message

Discussion in 'Plugin Development' started by random_username, Oct 11, 2013.

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

    random_username

    Hello, I was trying to cancell the message that appears when someone dies. I thought I could make something like this:
    Code:java
    1. @EventHandler
    2. public void onPlayerDeath(PlayerDeathEvent event){
    3. //some code here
    4. }


    I tried
    Code:java
    1. event.getDeathMessage().setCancelled(true);

    but apparently that doesn't work... any Ideas on how I can cancell the death message?
     
  2. Offline

    adam753

    Would this work?
    Code:
    event.setDeathMessage("");
    
     
  3. Offline

    random_username

    Thanks! :D
     
  4. Offline

    Skyost

    random_username adam753 A better way would be like this :
    Code:
    event.setDeathMessage(null);
    Because the "" is creating an object for nothing.
     
  5. Offline

    The_Doctor_123

    Skyost
    That may throw an exception, depends how Bukkit handled it. I'm just supposing that because the JavaDocs says nothing about when you set the value to null in that method.
     
    Skyost likes this.
Thread Status:
Not open for further replies.

Share This Page