@EventHandler(priority = EventPriority.LOWEST) public void onPlayerDeath(PlayerDeathEvent event) { EntityDamageEvent ede = event.getEntity().getLastDamageCause(); if ((ede != null) && (ede.getCause() != null) && (ede.getCause() == DamageCause.LAVA)) { Player player = event.getEntity(); Location loc = player.getLocation(); LavaTrain lT = LavaTrain.getLavaTrain(loc.getBlock()); if (lT != null) { event.setDeathMessage( player.getName() + " died swimming in " + lT.getPlayer().getName() + "'s lava train"); } } if (ede instanceof BendingDamageEvent) { Player player = event.getEntity(); BendingDamageEvent bede = (BendingDamageEvent) ede; if (bede.getAbility() == null) { event.setDeathMessage(player.getName() + " died from unknown bending"); } else { event.setDeathMessage( ChatColor.DARK_RED + player.getName() + ChatColor.RESET + " died from " + ChatColor.DARK_GREEN + bede.getAbility().getPlayer().getName() + ChatColor.RESET + "'s " + PluginTools.getColor(Settings.getColor(bede.getAbility().getElement())) + bede.getAbility().getName()); } } // Fireblade & Suffocate List<ItemStack> toRemove = new LinkedList<ItemStack>(); for (ItemStack item : event.getDrops()) { if (Suffocate.isTempHelmet(item)) { toRemove.add(item); } } event.getDrops().removeAll(toRemove); if (EntityTools.isGrabed(event.getEntity())) { EntityTools.unGrab(event.getEntity()); } }
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onInventoryClick(InventoryClickEvent event) { if (Suffocate.isTempHelmet(event.getCurrentItem())) { event.setCancelled(true); } }
@EventHandler public void onPlayerDropitem(PlayerDropItemEvent event) { if (Suffocate.isTempHelmet(event.getItemDrop().getItemStack())) { event.setCancelled(true); } }