Neues Inventarhandling #301
@ -29,8 +29,6 @@ import org.bukkit.event.block.BlockDispenseEvent;
|
|||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.inventory.Inventory;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
public class InFightInventory implements Listener {
|
public class InFightInventory implements Listener {
|
||||||
|
|
||||||
@ -40,22 +38,12 @@ public class InFightInventory implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryClick(InventoryClickEvent event) {
|
public void onInventoryClick(InventoryClickEvent event) {
|
||||||
Inventory clicked = event.getClickedInventory();
|
InventoryType top = event.getView().getTopInventory().getType();
|
||||||
if(event.getClick().isShiftClick()){
|
if(top == InventoryType.CRAFTING)
|
||||||
ItemStack clickedOn = event.getCurrentItem();
|
return;
|
||||||
|
|
||||||
if(
|
if ((event.getCursor() != null && event.getCursor().getType() != Material.TNT) || (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.TNT))
|
||||||
clickedOn != null &&
|
event.setCancelled(true); // Deny if transferred item is not TNT
|
||||||
event.getView().getTopInventory().getType() != InventoryType.CRAFTING &&
|
|
||||||
clicked == event.getWhoClicked().getInventory())
|
|
||||||
event.setCancelled(true);
|
|
||||||
}else if (
|
|
||||||
clicked != event.getWhoClicked().getInventory() &&
|
|
||||||
clicked != null &&
|
|
||||||
clicked.getType() != InventoryType.PLAYER &&
|
|
||||||
event.getCursor() != null &&
|
|
||||||
event.getCursor().getType() != Material.AIR)
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren