示例#1
0
  /**
   * Gets the set damage for the given damage type, as defined in config.yml.
   *
   * @param player The player to check damage for.
   * @param dCause The cause of the incurred damage.
   * @param defaultDamage The default value to return if no option is set for the given damage type.
   * @return The damage to deal to the player.
   */
  public int getDamage(String player, DamageCause dCause, int defaultDamage) {
    String job = getJob(player);
    List<String> damages = config.getKeys("config.all.damages");
    int damage = defaultDamage;

    if (damages != null) {
      for (String item : damages) {
        if (item.equalsIgnoreCase(dCause.name())) {
          damage = config.getInt("config.all.damages." + item, defaultDamage);
          break;
        }
      }
    }

    damages = config.getKeys("config.jobs." + job + ".damages");

    if (damages != null) {
      for (String item : damages) {
        if (item.equalsIgnoreCase(dCause.name())) {
          damage = config.getInt("config.jobs." + job + ".damages." + item, defaultDamage);
          break;
        }
      }
    }

    return damage;
  }
 @EventHandler(priority = EventPriority.HIGH)
 public void hurtVoid(EntityDamageEvent e) {
   DamageCause cause = e.getCause();
   Entity entity = e.getEntity();
   if (cause.equals(EntityDamageEvent.DamageCause.VOID)) {
     if (entity instanceof Player) {
       Player player = (Player) entity;
       if (player.hasPermission("kitpvp.coal")) {
         player.setHealth(20.0);
         player.setFallDistance(0.0F);
         player.teleport(Bukkit.getServer().getWorld("world").getSpawnLocation());
         Main.getKSC().put(player.getName(), 0);
         Util.msg(player, "You have fell off the map!");
         Util.ksm(player, "Your KillStreak was reset!");
         return;
       }
     }
   } else if (entity instanceof Player && cause == DamageCause.FALL) e.setCancelled(true);
 }
示例#3
0
  public PainSpell(MagicConfig config, String spellName) {
    super(config, spellName);

    damage = getConfigFloat("damage", 4);
    spellDamageType = getConfigString("spell-damage-type", "");
    ignoreArmor = getConfigBoolean("ignore-armor", false);
    checkPlugins = getConfigBoolean("check-plugins", true);

    String type = getConfigString("damage-type", "ENTITY_ATTACK");
    for (DamageCause cause : DamageCause.values()) {
      if (cause.name().equalsIgnoreCase(type)) {
        damageType = cause;
        break;
      }
    }
    if (damageType == null) {
      damageType = DamageCause.ENTITY_ATTACK;
    }
  }
  public ResistSpell(MagicConfig config, String spellName) {
    super(config, spellName);

    spellDamageTypes = getConfigStringList("spell-damage-types", null);
    List<String> list = getConfigStringList("normal-damage-types", null);
    multiplier = getConfigFloat("multiplier", 0.5F);

    if (list != null) {
      normalDamageTypes = new ArrayList<DamageCause>();
      for (String s : list) {
        for (DamageCause cause : DamageCause.values()) {
          if (cause.name().equalsIgnoreCase(s)) {
            normalDamageTypes.add(cause);
            break;
          }
        }
      }
      if (normalDamageTypes.size() == 0) normalDamageTypes = null;
    }
  }
  public void onEntityDamage(EntityDamageEvent event) {
    DamageCause cause = event.getCause();

    ArrayList<Integer> ids = iCoLand.landMgr.getLandIds(event.getEntity().getLocation());

    if (cause.equals(DamageCause.FIRE) || cause.equals(DamageCause.FIRE_TICK)) {
      for (Integer id : ids) {
        Land land = iCoLand.landMgr.getLandById(id);
        if (land.hasAddon("nofire")) {
          event.setCancelled(true);
        }
      }

      if (ids.size() == 0 && !Config.unclaimedLandCanBurn) {
        event.setCancelled(true);
      }
    } else if (cause.equals(DamageCause.BLOCK_EXPLOSION)
        || cause.equals(DamageCause.ENTITY_EXPLOSION)) {
      for (Integer id : ids) {
        Land land = iCoLand.landMgr.getLandById(id);
        if (land.hasAddon("noboom")) {
          event.setCancelled(true);
        }
      }

      if (ids.size() == 0 && !Config.unclaimedLandCanBoom) {
        event.setCancelled(true);
      }

    } else if (event instanceof EntityDamageByEntityEvent) {
      EntityDamageByEntityEvent castEvent = (EntityDamageByEntityEvent) event;
      if ((castEvent.getDamager() instanceof Player) && (castEvent.getEntity() instanceof Player)) {
        for (Integer id : ids) {
          if (iCoLand.landMgr.getLandById(id).hasAddon("nopvp")) event.setCancelled(true);
        }
      }
    }
  }
  @EventHandler(priority = EventPriority.HIGHEST)
  public void onEntityDeath(EntityDeathEvent event) {
    Entity died = event.getEntity();
    if (died instanceof Player) {
      Player pdied = (Player) died;
      if (plugin.isInArena(pdied)) {
        event.getDrops().clear();
        plugin.getArena(pdied).onPlayerDeath(plugin.getArenaPlayer(pdied));
      }
    }

    EntityDamageEvent dev = event.getEntity().getLastDamageCause();
    if (dev != null) {
      if (dev.getEntity() != null) {
        if (dev.getEntity() instanceof Player) {
          Player dead = (Player) event.getEntity();
          if (dev.getCause() != null) {
            DamageCause dc = dev.getCause();
            if (dc.equals(DamageCause.ENTITY_ATTACK)) {
              Entity damager = ((EntityDamageByEntityEvent) dev).getDamager();
              if (plugin.isInArena(dead)) {
                String attackerName = damager.getType().getName();
                if (damager instanceof Player) {
                  attackerName = ((Player) damager).getName();
                }
                event.getDrops().clear();

                ArenaPlayer dp = plugin.getArenaPlayer(dead);
                dp.killstreak = 0;
                dp.deaths++;

                String line1 =
                    ChatColor.GREEN
                        + attackerName
                        + ChatColor.WHITE
                        + " 杀死了 "
                        + ChatColor.RED
                        + dead.getName();
                String line2 = ChatColor.RED + dead.getName() + " 你已被 " + attackerName + " 击杀";
                String line3 = ChatColor.RED + "----------------------------";
                String line4 = ChatColor.RED + "杀敌: " + dp.kills;
                String line5 = ChatColor.RED + "死亡: " + dp.deaths;
                String line6 = ChatColor.RED + "----------------------------";

                dead.sendMessage(line1);
                dead.sendMessage(line2);
                dead.sendMessage(line3);
                dead.sendMessage(line4);
                dead.sendMessage(line5);
                dead.sendMessage(line6);

                if (damager instanceof Player) {
                  Player attacker = (Player) ((EntityDamageByEntityEvent) dev).getDamager();
                  if (plugin.isInArena(attacker)) {
                    ArenaPlayer ap = plugin.getArenaPlayer(attacker);
                    ap.kills++;
                    ap.killstreak++;
                    ap.XP += 100;

                    line2 = ChatColor.RED + "杀死了 " + dead.getName() + " +100 XP";
                    line4 = ChatColor.RED + "杀敌: " + plugin.getArenaPlayer(attacker).kills;
                    line5 = ChatColor.RED + "死亡: " + plugin.getArenaPlayer(attacker).deaths;

                    attacker.sendMessage(line1);
                    attacker.sendMessage(line2);
                    attacker.sendMessage(line3);
                    attacker.sendMessage(line4);
                    attacker.sendMessage(line5);
                    attacker.sendMessage(line6);
                    Arena ar = plugin.getArena(attacker);
                    ar.doKillStreak(plugin.getArenaPlayer(attacker));

                    // Call kill event
                    UltimateArenaKillEvent killEvent = new UltimateArenaKillEvent(dp, ap, ar);
                    plugin.getServer().getPluginManager().callEvent(killEvent);
                  }
                }
              }

              return;
            } else if (dc.equals(DamageCause.PROJECTILE)) {
              if (((EntityDamageByEntityEvent) dev)
                  .getDamager()
                  .getType()
                  .toString()
                  .toLowerCase()
                  .equals("snowball")) {
                Entity bullet = ((EntityDamageByEntityEvent) dev).getDamager();
                if (bullet instanceof Snowball) {
                  if (((Snowball) ((EntityDamageByEntityEvent) dev).getDamager()).getShooter()
                      instanceof Player) {
                    Player gunner =
                        (Player)
                            ((Snowball) ((EntityDamageByEntityEvent) dev).getDamager())
                                .getShooter();
                    if (gunner != null && plugin.isInArena(gunner)) {
                      String gunnerp = gunner.getName();
                      event.getDrops().clear();

                      // Dead player
                      if (dead instanceof Player) {
                        if (plugin.isInArena(dead.getLocation())) {
                          Player deadplayer = (Player) dead;
                          ArenaPlayer dp = plugin.getArenaPlayer(deadplayer);

                          dp.killstreak = 0;
                          dp.deaths++;

                          String line1 =
                              ChatColor.GREEN
                                  + deadplayer.getName()
                                  + ChatColor.WHITE
                                  + " 已被 "
                                  + ChatColor.RED
                                  + gunnerp
                                  + ChatColor.WHITE
                                  + " 杀死";
                          String line2 = ChatColor.RED + "----------------------------";
                          String line3 =
                              ChatColor.RED + "杀敌: " + plugin.getArenaPlayer(deadplayer).kills;
                          String line4 =
                              ChatColor.RED + "死亡: " + plugin.getArenaPlayer(deadplayer).deaths;
                          String line5 = ChatColor.RED + "----------------------------";

                          deadplayer.sendMessage(line1);
                          deadplayer.sendMessage(line2);
                          deadplayer.sendMessage(line3);
                          deadplayer.sendMessage(line4);
                          deadplayer.sendMessage(line5);
                        }
                      }

                      // Killer
                      if (gunner instanceof Player) {
                        if (plugin.isInArena(gunner)) {
                          plugin.getArenaPlayer(gunner).killstreak++;
                          plugin.getArenaPlayer(gunner).kills++;
                          plugin.getArenaPlayer(gunner).XP += 25;

                          String line1 =
                              ChatColor.GREEN
                                  + gunnerp
                                  + ChatColor.WHITE
                                  + " 杀死了 "
                                  + ChatColor.RED
                                  + dead.getType().getName();
                          String line2 = ChatColor.RED + "----------------------------";
                          String line3 =
                              ChatColor.RED + "杀敌: " + plugin.getArenaPlayer(gunner).kills;
                          String line4 =
                              ChatColor.RED + "死亡: " + plugin.getArenaPlayer(gunner).deaths;
                          String line5 = ChatColor.RED + "----------------------------";

                          gunner.sendMessage(line1);
                          gunner.sendMessage(line2);
                          gunner.sendMessage(line3);
                          gunner.sendMessage(line4);
                          gunner.sendMessage(line5);
                        }
                      }
                    }
                  }
                }
              }

              return;
            } else {
              if (plugin.isInArena(dead)) {
                event.getDrops().clear();
                plugin.getArenaPlayer(dead).killstreak = 0;

                plugin.getArenaPlayer(dead).deaths++;
                String line2 = ChatColor.RED + dead.getName() + " 你已被 " + dc.toString() + " 杀死";
                String line3 = ChatColor.RED + "----------------------------";
                String line4 = ChatColor.RED + "杀敌: " + plugin.getArenaPlayer(dead).kills;
                String line5 = ChatColor.RED + "死亡: " + plugin.getArenaPlayer(dead).deaths;
                String line6 = ChatColor.RED + "----------------------------";

                dead.sendMessage(line2);
                dead.sendMessage(line3);
                dead.sendMessage(line4);
                dead.sendMessage(line5);
                dead.sendMessage(line6);
              }

              return;
            }
          }
        } else {
          LivingEntity dead = (LivingEntity) event.getEntity();
          if (dev.getCause() != null) {
            DamageCause dc = dev.getCause();
            if (dc.equals(DamageCause.PROJECTILE)) {
              if (((EntityDamageByEntityEvent) dev)
                  .getDamager()
                  .getType()
                  .toString()
                  .equalsIgnoreCase("snowball")) {
                Entity bullet = ((EntityDamageByEntityEvent) dev).getDamager();
                if (bullet instanceof Snowball) {
                  if (((Snowball) ((EntityDamageByEntityEvent) dev).getDamager()).getShooter()
                      instanceof Player) {
                    Player gunner =
                        (Player)
                            ((Snowball) ((EntityDamageByEntityEvent) dev).getDamager())
                                .getShooter();
                    if (gunner != null) {
                      String gunnerp = gunner.getName();
                      event.getDrops().clear();

                      // Dead player
                      if (dead instanceof Player) {
                        if (plugin.isInArena(dead.getLocation())) {
                          Player deadplayer = (Player) dead;
                          plugin.getArenaPlayer(deadplayer).killstreak = 0;
                          plugin.getArenaPlayer(deadplayer).deaths++;
                          String line1 =
                              ChatColor.GREEN
                                  + deadplayer.getName()
                                  + ChatColor.WHITE
                                  + " 已被 "
                                  + ChatColor.RED
                                  + gunnerp
                                  + ChatColor.WHITE
                                  + " 杀死";
                          String line2 = ChatColor.RED + "----------------------------";
                          String line3 =
                              ChatColor.RED + "杀敌: " + plugin.getArenaPlayer(deadplayer).kills;
                          String line4 =
                              ChatColor.RED + "死亡: " + plugin.getArenaPlayer(deadplayer).deaths;
                          String line5 = ChatColor.RED + "----------------------------";

                          deadplayer.sendMessage(line1);
                          deadplayer.sendMessage(line2);
                          deadplayer.sendMessage(line3);
                          deadplayer.sendMessage(line4);
                          deadplayer.sendMessage(line5);
                        }
                      }

                      // Killer
                      if (gunner instanceof Player) {
                        if (plugin.isInArena(gunner)) {
                          plugin.getArenaPlayer(gunner).killstreak++;
                          plugin.getArenaPlayer(gunner).kills++;
                          plugin.getArenaPlayer(gunner).XP += 25;

                          String line1 =
                              ChatColor.GREEN
                                  + gunnerp
                                  + ChatColor.WHITE
                                  + " 杀死了 "
                                  + ChatColor.RED
                                  + dead.getType().getName();
                          String line2 = ChatColor.RED + "----------------------------";
                          String line3 =
                              ChatColor.RED + "杀敌: " + plugin.getArenaPlayer(gunner).kills;
                          String line4 =
                              ChatColor.RED + "死亡: " + plugin.getArenaPlayer(gunner).deaths;
                          String line5 = ChatColor.RED + "----------------------------";

                          gunner.sendMessage(line1);
                          gunner.sendMessage(line2);
                          gunner.sendMessage(line3);
                          gunner.sendMessage(line4);
                          gunner.sendMessage(line5);
                        }
                      }

                      if ((gunner instanceof Player) && (dead instanceof Player)) {
                        if ((gunner != null) && (dead != null)) {
                          ArenaPlayer ag = plugin.getArenaPlayer(gunner);
                          ArenaPlayer ad = plugin.getArenaPlayer((Player) dead);
                          Arena ar = plugin.getArena(gunner);

                          UltimateArenaKillEvent killEvent = new UltimateArenaKillEvent(ad, ag, ar);
                          plugin.getServer().getPluginManager().callEvent(killEvent);
                        }
                      }
                    }
                  }
                }
              }

              return;
            } else if (dc.equals(DamageCause.ENTITY_ATTACK)) {
              Entity damager = ((EntityDamageByEntityEvent) dev).getDamager();
              if (damager instanceof Player) {
                Player attacker = (Player) ((EntityDamageByEntityEvent) dev).getDamager();
                if (plugin.isInArena(attacker)) {
                  event.getDrops().clear();
                  if (plugin.isInArena(attacker.getLocation())) {
                    plugin.getArenaPlayer(attacker).kills++;
                    plugin.getArenaPlayer(attacker).killstreak++;
                    plugin.getArenaPlayer(attacker).XP += 25;

                    String attstr = dead.getType().getName();

                    String line1 =
                        ChatColor.GREEN
                            + attacker.getName()
                            + ChatColor.WHITE
                            + " 杀死了 "
                            + ChatColor.RED
                            + attstr;
                    String line2 = ChatColor.RED + "杀死了 " + attstr + " +25 XP";
                    String line3 = ChatColor.RED + "----------------------------";
                    String line4 = ChatColor.RED + "杀敌: " + plugin.getArenaPlayer(attacker).kills;
                    String line5 = ChatColor.RED + "死亡: " + plugin.getArenaPlayer(attacker).deaths;
                    String line6 = ChatColor.RED + "----------------------------";

                    attacker.sendMessage(line1);
                    attacker.sendMessage(line2);
                    attacker.sendMessage(line3);
                    attacker.sendMessage(line4);
                    attacker.sendMessage(line5);
                    attacker.sendMessage(line6);

                    Arena ar = plugin.getArena(attacker);
                    ar.doKillStreak(plugin.getArenaPlayer(attacker));
                  }
                }
              }

              return;
            } else if (dc.equals(DamageCause.PROJECTILE)) {
              Entity damager = ((EntityDamageByEntityEvent) dev).getDamager();
              if (damager instanceof Arrow) {
                if (((Arrow) ((EntityDamageByEntityEvent) dev).getDamager()).getShooter()
                    instanceof Player) {
                  Player attacker =
                      (Player)
                          ((Arrow) ((EntityDamageByEntityEvent) dev).getDamager()).getShooter();
                  if (plugin.isInArena(attacker)) {
                    event.getDrops().clear();
                    if (plugin.isInArena(attacker.getLocation())) {
                      plugin.getArenaPlayer(attacker).kills++;
                      plugin.getArenaPlayer(attacker).killstreak++;
                      plugin.getArenaPlayer(attacker).XP += 25;

                      String attstr = dead.getType().getName();

                      String line1 =
                          ChatColor.GREEN
                              + attacker.getName()
                              + ChatColor.WHITE
                              + " 杀死了 "
                              + ChatColor.RED
                              + attstr;
                      String line2 = ChatColor.RED + "杀死了 " + attstr + " +25 XP";
                      String line3 = ChatColor.RED + "----------------------------";
                      String line4 = ChatColor.RED + "杀敌: " + plugin.getArenaPlayer(attacker).kills;
                      String line5 =
                          ChatColor.RED + "死亡: " + plugin.getArenaPlayer(attacker).deaths;
                      String line6 = ChatColor.RED + "----------------------------";

                      attacker.sendMessage(line1);
                      attacker.sendMessage(line2);
                      attacker.sendMessage(line3);
                      attacker.sendMessage(line4);
                      attacker.sendMessage(line5);
                      attacker.sendMessage(line6);

                      Arena ar = plugin.getArena(attacker);
                      ar.doKillStreak(plugin.getArenaPlayer(attacker));
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  @EventHandler(priority = EventPriority.MONITOR)
  public void onEntityDamage(EntityDamageEvent event) {

    if (event.isCancelled() == false && !worlds.contains(event.getEntity().getWorld().getName())) {

      Entity attacker = null;
      Projectile projectile = null;
      if (event instanceof EntityDamageByEntityEvent) {
        EntityDamageByEntityEvent ed = (EntityDamageByEntityEvent) event;
        attacker = ed.getDamager();

        // handle arrow attacks
        if (ed.getDamager() instanceof Projectile) {
          projectile = ((Projectile) attacker);
          attacker = projectile.getShooter();
        }
      }

      Entity entity = event.getEntity();
      if (entity instanceof ComplexEntityPart) {
        entity = ((ComplexEntityPart) entity).getParent();
      }
      int damage = event.getDamage();
      DamageCause cause = event.getCause();
      // if the player gets attacked
      if (entity instanceof Player) {
        // global damage count
        playerStatManager
            .getPlayerBlob(((Player) entity).getName())
            .getStat("damagetaken", "total")
            .incrementStat(damage);
        // handle projectiles
        if (projectile != null) {
          playerStatManager
              .getPlayerBlob(((Player) entity).getName())
              .getStat(
                  "damagetaken", projectile.getType().toString().toLowerCase().replace("_", ""))
              .incrementStat(damage);
        }

        playerStatManager
            .getPlayerBlob(((Player) entity).getName())
            .getStat("damagetaken", cause.toString().toLowerCase().replace("_", ""))
            .incrementStat(damage);

        // pvp damage
        if (attacker instanceof Player) {
          playerStatManager
              .getPlayerBlob(((Player) entity).getName())
              .getStat("damagetaken", "player")
              .incrementStat(damage);
          playerStatManager
              .getPlayerBlob(((Player) attacker).getName())
              .getStat("damagedealt", "player")
              .incrementStat(damage);
          // mob damage
        } else if (attacker != null) {
          playerStatManager
              .getPlayerBlob(((Player) entity).getName())
              .getStat("damagetaken", attacker.getType().toString().toLowerCase().replace("_", ""))
              .incrementStat(damage);
        }

      } else {
        if (attacker instanceof Player) {
          // global damage dealt
          playerStatManager
              .getPlayerBlob(((Player) attacker).getName())
              .getStat("damagedealt", "total")
              .incrementStat(damage);
          playerStatManager
              .getPlayerBlob(((Player) attacker).getName())
              .getStat("damagedealt", cause.toString().toLowerCase().replace("_", ""))
              .incrementStat(damage);
          playerStatManager
              .getPlayerBlob(((Player) attacker).getName())
              .getStat("damagedealt", entity.getType().toString().toLowerCase().replace("_", ""))
              .incrementStat(damage);
        }
      }
    }
  }
  @EventHandler(priority = EventPriority.MONITOR)
  public void onEntityDeath(EntityDeathEvent event) {

    EntityDamageEvent lastCause = event.getEntity().getLastDamageCause();
    DamageCause cause = null;
    if (lastCause != null) {
      cause = lastCause.getCause();
    }

    Entity attacker = null;
    Projectile projectile = null;
    if (lastCause instanceof EntityDamageByEntityEvent) {
      attacker = ((EntityDamageByEntityEvent) lastCause).getDamager();
      BeardStat.printDebugCon("attack ID'd Fired"); // Type.ENTITY_DEATH
      if (attacker instanceof Projectile) {
        projectile = ((Projectile) attacker);
        attacker = projectile.getShooter();
      }
    }
    Entity entity = event.getEntity();

    // set attacker and entity total k/d accordingly
    if (entity instanceof Player) {
      playerStatManager
          .getPlayerBlob(((Player) entity).getName())
          .getStat("deaths", "total")
          .incrementStat(1);
      if (cause != null) {
        playerStatManager
            .getPlayerBlob(((Player) entity).getName())
            .getStat("deaths", cause.toString().toLowerCase().replace("_", ""))
            .incrementStat(1);
      }
      if (projectile != null) {
        playerStatManager
            .getPlayerBlob(((Player) entity).getName())
            .getStat("deaths", projectile.getType().toString().toLowerCase().replace("_", ""))
            .incrementStat(1);
      }
    }

    if (attacker instanceof Player) {
      playerStatManager
          .getPlayerBlob(((Player) attacker).getName())
          .getStat("kills", "total")
          .incrementStat(1);
      if (cause != null) {
        playerStatManager
            .getPlayerBlob(((Player) attacker).getName())
            .getStat("kills", cause.toString().toLowerCase().replace("_", ""))
            .incrementStat(1);
      }
      if (projectile != null) {
        playerStatManager
            .getPlayerBlob(((Player) attacker).getName())
            .getStat("kills", projectile.getType().toString().toLowerCase().replace("_", ""))
            .incrementStat(1);
      }
    }

    // PVP
    if (entity instanceof Player && attacker instanceof Player) {
      playerStatManager
          .getPlayerBlob(((Player) entity).getName())
          .getStat("deaths", "player")
          .incrementStat(1);
      playerStatManager
          .getPlayerBlob(((Player) attacker).getName())
          .getStat("kills", "player")
          .incrementStat(1);
    }
    // global damage count

    // PLAYER KILLS ENTITY

    if ((entity instanceof Player) == false && attacker instanceof Player) {
      // global damage dealt
      // playerStatManager.getPlayerBlob(((Player)attacker).getName()).getStat("kill_by_"+
      // cause.toString().toLowerCase()).incrementStat(1);
      playerStatManager
          .getPlayerBlob(((Player) attacker).getName())
          .getStat("kills", entity.getType().toString().replace("_", "").toLowerCase())
          .incrementStat(1);
    }
    // ENTITY KILLS PLAYER
    if ((entity instanceof Player) && !(attacker instanceof Player) && attacker != null) {
      playerStatManager
          .getPlayerBlob(((Player) entity).getName())
          .getStat("deaths", attacker.getType().toString().replace("_", ""))
          .incrementStat(1);
    }
  }
示例#9
0
  /*
   *
   * ################################################
   *
   * 			   HANDLE PLAYER DEATH
   *
   *  PLAYERS DIE A REAL DEATH WHICH IS HANDLED HERE
   *
   * ################################################
   *
   *
   */
  public void playerDeath(PlayerDeathEvent e) {
    final Player p = e.getEntity();
    if (!activePlayers.contains(p)) return;

    sm.playerDied(p, activePlayers.size(), gameID, new Date().getTime() - startTime);
    scoreBoard.playerDead(p);
    activePlayers.remove(p);
    inactivePlayers.add(p);
    for (Object in : spawns.keySet().toArray()) {
      if (spawns.get(in) == p) spawns.remove(in);
    }

    PlayerKilledEvent pk = null;
    if (mode != GameMode.WAITING
        && p.getLastDamageCause() != null
        && p.getLastDamageCause().getCause() != null) {
      DamageCause cause = p.getLastDamageCause().getCause();
      switch (cause) {
        case ENTITY_ATTACK:
          if (p.getLastDamageCause().getEntityType() == EntityType.PLAYER) {
            EntityType enttype = p.getLastDamageCause().getEntityType();
            Player killer = p.getKiller();
            String killername = "Unknown";

            if (killer != null) {
              killername = killer.getName();
            }

            String itemname = "Unknown Item";
            if (killer != null) {
              itemname = ItemReader.getFriendlyItemName(killer.getItemInHand().getType());
            }

            msgFall(
                PrefixType.INFO,
                "death." + enttype,
                "player-" + p.getName(),
                "killer-" + killername,
                "item-" + itemname);

            if (killer != null && p != null) {
              sm.addKill(killer, p, gameID);
              scoreBoard.incScore(killer);
            }
            pk = new PlayerKilledEvent(p, this, killer, cause);
          } else {
            msgFall(
                PrefixType.INFO,
                "death." + p.getLastDamageCause().getEntityType(),
                "player-" + p.getName(),
                "killer-" + p.getLastDamageCause().getEntityType());
            pk = new PlayerKilledEvent(p, this, null, cause);
          }
          break;
        default:
          msgFall(
              PrefixType.INFO, "death." + cause.name(), "player-" + p.getName(), "killer-" + cause);
          pk = new PlayerKilledEvent(p, this, null, cause);

          break;
      }
      Bukkit.getServer().getPluginManager().callEvent(pk);

      if (getActivePlayers() > 1) {
        for (Player pl : getAllPlayers()) {
          msgmgr.sendMessage(
              PrefixType.INFO,
              ChatColor.DARK_AQUA
                  + "There are "
                  + ChatColor.YELLOW
                  + ""
                  + getActivePlayers()
                  + ChatColor.DARK_AQUA
                  + " players remaining!",
              pl);
        }
      }
    }

    for (Player pe : activePlayers) {
      Location l = pe.getLocation();
      l.setY(l.getWorld().getMaxHeight());
      l.getWorld().strikeLightningEffect(l);
    }

    if (getActivePlayers() <= config.getInt("endgame.players")
        && config.getBoolean("endgame.fire-lighting.enabled")
        && !endgameRunning) {

      tasks.add(
          Bukkit.getScheduler()
              .scheduleSyncRepeatingTask(
                  GameManager.getInstance().getPlugin(),
                  new EndgameManager(),
                  0,
                  config.getInt("endgame.fire-lighting.interval") * 20));
    }

    if (activePlayers.size() < 2 && mode == GameMode.INGAME) {
      mode = GameMode.FINISHING;
      LobbyManager.getInstance().updateWall(gameID);
      tasks.add(
          Bukkit.getScheduler()
              .scheduleSyncDelayedTask(
                  GameManager.getInstance().getPlugin(),
                  new Runnable() {
                    public void run() {
                      playerWin(p);
                      endGame();
                    }
                  },
                  10L));
    }
    LobbyManager.getInstance().updateWall(gameID);
  }