From e8aa591b7bd0754ab55ede4de76fb765f7ba0887 Mon Sep 17 00:00:00 2001 From: myiume Date: Sat, 16 Feb 2013 17:10:57 +0200 Subject: [PATCH] Update src/me/ryanhamshire/TekkitCustomizer/PlayerEventHandler.java Changed the way the item usage gets banned. Instead of cancelling the action it drops the item to the ground before the action happens. I did that for the items in modpacks that will get past the .setCancelled(). --- src/me/ryanhamshire/TekkitCustomizer/PlayerEventHandler.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/me/ryanhamshire/TekkitCustomizer/PlayerEventHandler.java b/src/me/ryanhamshire/TekkitCustomizer/PlayerEventHandler.java index 6f73008..3599f46 100644 --- a/src/me/ryanhamshire/TekkitCustomizer/PlayerEventHandler.java +++ b/src/me/ryanhamshire/TekkitCustomizer/PlayerEventHandler.java @@ -116,8 +116,9 @@ void onPlayerInteract(PlayerInteractEvent event) bannedInfo = TekkitCustomizer.instance.isBanned(ActionType.Usage, player, player.getItemInHand().getTypeId(), player.getItemInHand().getData().getData(), player.getLocation()); if(bannedInfo != null) - { - event.setCancelled(true); + { event.setCancelled(true); + player.getLocation().getWorld().dropItemNaturally(player.getLocation(), player.getItemInHand().clone()).setPickupDelay(40); + player.getInventory().setItemInHand(new ItemStack(Material.AIR)); player.sendMessage("Sorry, usage of that item has been banned. Reason: " + bannedInfo.reason); } }