示例#1
0
 // Battle Arena Anti-Cheat
 @EventHandler(priority = EventPriority.MONITOR)
 public void stopOutsideDamage(EntityDamageByEntityEvent e) {
   if (e.getEntity() instanceof Player) {
     Player damaged = (Player) e.getEntity();
     if (e.getDamager() instanceof Player) {
       Player damager = (Player) e.getDamager();
       if (!BattleArena.inArena(damager)) {
         if (BattleArena.inArena(damaged)) {
           e.setCancelled(true);
           Bukkit.broadcastMessage("CANCELLED!");
         }
       }
     }
   }
 }
示例#2
0
 @EventHandler
 public void openInventory(InventoryOpenEvent e) {
   if (BattleArena.inArena((Player) e.getPlayer())) {
     e.setCancelled(true);
   }
   List<Player> inProgress = ma.getArenaMaster().getAllPlayers();
   for (Player p2 : inProgress) {
     if (e.getPlayer() == p2) {
       e.setCancelled(true);
     }
   }
 }
示例#3
0
 @EventHandler
 public void stopArenaInteract(PlayerInteractEvent e) {
   if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
     Player p = e.getPlayer();
     if (BattleArena.inArena(p)) {
       e.setCancelled(true);
     }
     List<Player> inProgress = ma.getArenaMaster().getAllPlayers();
     for (Player p2 : inProgress) {
       if (p == p2) {
         e.setCancelled(true);
       }
     }
   }
 }