tracking the total damage done by an individual on a mob (or other player)

Discussion in 'Plugin Development' started by undeadmach1ne, Sep 16, 2011.

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

    undeadmach1ne

    anyone have any good ideas on how to keep track of the total amount of dmg done by each player to a mob so i can 'do stuff' with that info onEntityDeath? (example: fred did 'x' damage to the zombie and jane did 'y'. fred gets 'x' dollars and jane gets 'y' dollars as a reward for killing it)

    thanks
     
  2. Use HashMaps and/or self defined "storage classes". such a class could look like this:
    Code:
    public class foo
    {
      UUID id; // UUID of the mob
      HashMap<String, Integer> damage = new HashMap<String, Integer>; // The string is a players name, the int value the damage he made.
    }
    The rest is listening to entityDamage events + some math.... ;)
     
  3. Offline

    undeadmach1ne

    thanks ill try to figure that out :p
     
Thread Status:
Not open for further replies.

Share This Page