示例#1
0
  // register that we just received this damage
  public void registerDamage(EntityDamageEvent e) {
    // sanity check...
    if (e.getEntity() != getPlayer()) return;

    // get the last damage cause, and mark that as the cause of the damage
    AutoRefPlayer.DamageCause dc = AutoRefPlayer.DamageCause.fromDamageEvent(e);
    damage.put(dc, e.getDamage() + damage.get(dc));
  }
示例#2
0
  // register that we just died
  public void registerDeath(PlayerDeathEvent e) {
    // sanity check...
    if (e.getEntity() != getPlayer()) return;

    // get the last damage cause, and mark that as the cause of one death
    AutoRefPlayer.DamageCause dc =
        AutoRefPlayer.DamageCause.fromDamageEvent(e.getEntity().getLastDamageCause());
    deaths.put(dc, 1 + deaths.get(dc));
    ++totalDeaths;

    AutoRefMatch match = getTeam().getMatch();
    Location loc = e.getEntity().getLocation();
    match.addEvent(
        new TranscriptEvent(
            match, TranscriptEvent.EventType.PLAYER_DEATH, e.getDeathMessage(), loc, this, dc.p));
  }