Throwing TNT: Fixed tnt not being movable from other inventories

This commit is contained in:
libraryaddict 2015-04-23 08:30:23 +12:00
parent ae1480fb1e
commit 1c1ab9bbe3

View File

@ -6,6 +6,7 @@ import mineplex.core.recharge.*;
import mineplex.core.updater.*; import mineplex.core.updater.*;
import mineplex.core.updater.event.*; import mineplex.core.updater.event.*;
import nautilus.game.arcade.kit.*; import nautilus.game.arcade.kit.*;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.block.*; import org.bukkit.block.*;
import org.bukkit.entity.*; import org.bukkit.entity.*;
@ -133,6 +134,26 @@ public class PerkBomber extends Perk
@EventHandler @EventHandler
public void TNTInvClick(InventoryClickEvent event) public void TNTInvClick(InventoryClickEvent event)
{ {
// If they have a inventory open
if (event.getView().getTopInventory().getHolder() instanceof Player)
{
return;
}
// If they are clicking in their own inventory
if (event.getClickedInventory() != null && event.getClickedInventory().getHolder() instanceof Player)
{
// If its not a shift click
if (!event.isShiftClick())
{
return;
}
} // Else if they are not clicking in their own inventory make sure they don't have tnt in their hands
else if (event.getCursor() == null || event.getCursor().getType() != Material.TNT)
{
return;
}
UtilInv.DisallowMovementOf(event, "Throwing TNT", Material.TNT, (byte) 0, true); UtilInv.DisallowMovementOf(event, "Throwing TNT", Material.TNT, (byte) 0, true);
} }