Class LootTally

java.lang.Object
privbot.mechanics.LootTally

public final class LootTally extends Object
Counts kills and loot per NPC name, so a plugin can report what a trip earned.

What it proves: figures are exactly what was recorded, nothing inferred. An NPC never seen reads 0 kills, 0 value and an empty item map, which here truly means "none recorded".

Unreadable looks like: a null NPC or item name is ignored, and a non-positive quantity is ignored.

Thread rule: not thread safe; keep it on one thread (the worker that records the loot).

  • Constructor Details

    • LootTally

      public LootTally()
  • Method Details

    • recordKill

      public void recordKill(String npc)
      Counts one kill of npc.
    • record

      public void record(String npc, String item, int qty, long value)
      Records qty of item (worth value in total) from npc.
    • kills

      public int kills(String npc)
      Returns:
      kills recorded for npc
    • value

      public long value(String npc)
      Returns:
      total loot value recorded for npc
    • totalValue

      public long totalValue()
      Returns:
      total loot value over every NPC
    • items

      public Map<String,Integer> items(String npc)
      Returns:
      item name to total quantity for npc (a copy; empty when none)
    • reset

      public void reset()
      Forgets everything.