how to make custom death messages

Discussion in 'Plugin Development' started by edragy, Jul 10, 2012.

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

    edragy

    Title says it all
     
  2. Offline

    EnvisionRed

    Um, listen for playerdeathevent, then getCause, and based on the cause broadcast a different message? I really recommend taking a look at the javadoc as it contains all the information you need.
     
    Deathmarine likes this.
  3. Offline

    edragy

    I was hoping someone would just give me some code for it
     
  4. edragy
    If you're not even going to try to make it, then I suggest you post in "Plugin Requests" section.
     
  5. Offline

    edragy

    I just can't find getCause

    bump?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
  6. Offline

    ZeusAllMighty11

    Why bump more than once in an hour? :\

    @EventHandler
    public void onPlayerDeath(PayerDeathEvent e){
    Player player = e.getPlayer();
    Cause cause = e.getCause();
    if (cause == lava){
    bukkit.broadcast(e.getPlayer + " tried to swim in lava");
    }
    }
     
  7. Offline

    edragy

    I haven't tested it, but won't using bukkit.broadcast display the new death message and the old one?
     
  8. Offline

    dxwarlock

    just add a cancel event then send your message might work.
    not sure if that would cancel the death, but I dont think so, as its triggered AFTER the death.
     
  9. Offline

    edragy

    That code doesn't work. "Cause cannot be resolved to a type" and "The method getPlayer() is undefined for the type PlayerDeathEvent" and "The method getCause() is undefined for the type PlayerDeathEvent" and "lava cannot be resolved to a variable" and "bukkit cannot be resolved" and " getPlayer cannot be resolved or is not a field".
    stupid buggy code...

    ZeusAllMighty11
     
  10. Offline

    dxwarlock

    Player p = event.getEntity();
    if that doesnt work try
    Player p = (Player) event.getEntity();

    for damage:
    p.getLastDamageCause().getCause()
     
  11. Offline

    ZeusAllMighty11

    It's Pseudo code...don't be a skid...
     
  12. Offline

    Deathmarine

    Sorry I hate to say were not going to spoon feed so you can rip someone else off.
    http://wiki.bukkit.org/Portal:Developers is all the information you need to know to make a plugin.
     
Thread Status:
Not open for further replies.

Share This Page