Who died how in the console

Discussion in 'Archived: Plugin Requests' started by vrox, Jun 21, 2011.

  1. Offline

    vrox

    This may already exists somewhere, in which case a link to it would be nice, but I'd like a plugin which returns to the console how someone died and who died whenever a death occurs. I ghost quite a bit, and its irritating only seeing 'respawn triggered'.
     
  2. Offline

    DreadKyller

    should be extremely easy. I'll check around first to see if it exists, although I do not think so

    EDIT: my 5 searches only showed up 8 results, and none were of this type, only thing close was HeroicDeath. I can start on this if no one else wants.

    Estimated Time: 15-30 minutes

    EDIT 2: finished, testing now
     
  3. Offline

    McSpazzy

    I have a custom plugin that does this, as well as a mysql logging, and death announcing. If all you want is for it to log to console. I can remove some code for you. Unless DreadKyller does it first =p
     
  4. Offline

    DreadKyller

    the only problem I'm having is that with lava and fire damage killing you it prints several times to the console and not only once... but only if no monsters, it's because of the regeneration of health...
     
  5. Offline

    McSpazzy

    @DreadKyller How so? onEntityDeath should be called only once, when they actually die.
     
  6. Offline

    DreadKyller

    the problem is, onEntityDeath does not have a getCause, therefore I have to use onEntityDamage() and see if the player health minus the damage that will be applied is<=0 (death), if so then based on the cause print something.
     
  7. Offline

    McSpazzy

    Use onEntityDamage() to keep track of what did the most recent damage to the player. Then when they die, check the list for that player, and see what did the damage. Ive stripped down the code from mine that does this. I cant take credit for some of it, i got parts from a plugin i dont remember the name of. http://pastebin.com/FuJ1YN2x

    and the whole cut down source if you want to check it out.
    http://www.mcspazzy.com/minecraft/plugins/McDeath/consolesrc/
     
  8. Offline

    DreadKyller

    Oo, I completely forgot that there is a thing called player.getLastDamageCause(), I'm so fkin dumb... that makes it a lot easier, on deatch do exactly like I have it, only from the "LastDamageCause" of the player.

    EDIT:

    completed but I g2g, I'll post tomorrow
     
  9. Offline

    vrox

    Alright, thanks
     
  10. Offline

    DreadKyller

    ok, this is getting really strange, I have this:

    Code:java
    1. public void onEntityDeath(EntityDeathEvent event){
    2. if(event.getEntity() instanceof Player){
    3. Player p = (Player) event.getEntity();
    4. DamageCause cause = p.getLastDamageCause().getCause();
    5. if(cause==DamageCause.LAVA){
    6. System.out.println("Player "+p.getDisplayName()+" died in lava at "+p.getLocation.getX()+" ,"+p.getLocation.getY()+" ,"+p.getLocation.getZ());
    7. else if...
    8. else if...
    9. else{
    10. System.out.println("player"+p.getDisplayName()+" died by "+cause.name()+" at "+p.getLocation.getX()+" ,"+p.getLocation.getY()+" ,"+p.getLocation.getZ());
    11. }
    12. }
    13. }


    at first I did not include the last line and I went to try dieing in lava, and no messsage appeard, kept trying, still nothing, I added that line and I got "player DreadKyller dies by LAVA at 45, 72, 263" so I don't get why it did not work as it was supposed to. I'm going to use the strings to compare now...
     
  11. Offline

    vrox

    Ill just nod my head and pretend to know what you're talking about :p
     

Share This Page