/** * Called when a player attempts to drop an item * * @param event Relevant event details */ @Override public void onPlayerDropItem(PlayerDropItemEvent event) { if (event.isCancelled()) { return; } GlobalConfiguration cfg = plugin.getGlobalConfiguration(); WorldConfiguration wcfg = cfg.getWorldConfig(event.getPlayer().getWorld().getName()); if (wcfg.getBlacklist() != null) { Item ci = event.getItemDrop(); if (!wcfg.getBlacklist() .check( new ItemDropBlacklistEvent( BukkitPlayer.wrapPlayer(plugin, event.getPlayer()), toVector(ci.getLocation()), ci.getItemStack().getTypeId()), false, false)) { event.setCancelled(true); return; } } }
@EventHandler(priority = EventPriority.NORMAL) public void onPlayerDropItem(PlayerDropItemEvent event) { if (TotalFreedomMod.autoEntityWipe) { if (event.getPlayer().getWorld().getEntities().size() > 750) { event.setCancelled(true); } else { event.getItemDrop().remove(); } } }
@EventHandler(priority = EventPriority.NORMAL) public void onPlayerDropItem(PlayerDropItemEvent event) { if (TFM_ConfigEntry.AUTO_ENTITY_WIPE.getBoolean()) { if (event.getPlayer().getWorld().getEntities().size() > 750) { event.setCancelled(true); } else { event.getItemDrop().remove(); } } }