@EventHandler public void onPlayerPlaceBlock(BlockPlaceEvent e) { int id = gm.getPlayerGameId(e.getPlayer()); if (id != -1) { if (gm.getGame(id).getState() == State.INGAME) gm.getPlayerClass(e.getPlayer()).PlayerPlaceBlock(e.getBlock()); } }
@EventHandler public void onEntityDamaged(EntityDamageByEntityEvent e) { try { Player victim = null; Player attacker = null; if (e.getEntity() instanceof Player) { victim = (Player) e.getEntity(); } if (e.getDamager() instanceof Player) { attacker = (Player) e.getDamager(); } if (victim != null && attacker != null) { if (gm.getPlayerGameId(victim) != -1 && gm.getPlayerGameId(attacker) != -1) { gm.getPlayerClass(victim).PlayerDamaged(); gm.getPlayerClass(attacker).PlayerAttack(victim); } } } catch (Exception et) { } }
@EventHandler public void onEntityDeath(PlayerDeathEvent e) { if (e.getEntity() instanceof Player) { Player p = (Player) e.getEntity(); int id = gm.getPlayerGameId(p); if (id != -1) { gm.getPlayerClass(p).PlayerDeath(); gm.getGame(id).killPlayer(p, e.getDeathMessage()); e.setDeathMessage(null); } } }