@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onPlayerItemConsume(PlayerItemConsumeEvent event) { String playerName = event.getPlayer().getName(); if (ultimateGames.getPlayerManager().isPlayerInArena(playerName)) { Arena arena = ultimateGames.getPlayerManager().getPlayerArena(playerName); if (arena.getStatus() == ArenaStatus.RUNNING) { arena.getGame().getGamePlugin().onPlayerItemConsume(arena, event); } else { event.setCancelled(true); } } else if (ultimateGames.getPlayerManager().isPlayerSpectatingArena(playerName)) { event.setCancelled(true); } }
@EventHandler public void playerEatEvent(PlayerItemConsumeEvent e) { if (!Minegusta.getServer().containsWorld(e.getPlayer().getWorld())) return; ElfPower fruit = ElfPower.consumeFruit(e); ElfInfect food = ElfInfect.elfInfect(e); if (fruit.isPlayer() && fruit.isElf() && fruit.isFruit()) { fruit.applyFoodRegenBoost(); } if (food.isHuman() && food.hasLore() && food.isVeganStew()) { food.makeElf(); } }