SteamWar/FightSystem
Archiviert
13
1

Fixing inventory item handling

Dieser Commit ist enthalten in:
Lixfel 2019-07-21 13:04:27 +02:00
Ursprung d430311693
Commit e61ef0ba66

Datei anzeigen

@ -2,6 +2,7 @@ package me.yaruma.fightsystem.listener;
import me.yaruma.fightsystem.FightSystem;
import me.yaruma.fightsystem.fight.FightState;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
@ -26,14 +27,15 @@ public class InventoryListener implements Listener {
if (clickedOn != null && event.getView().getTopInventory().getType() != InventoryType.CRAFTING && clicked == event.getWhoClicked().getInventory()) {
event.setCancelled(true);
}
}else if (clicked != event.getWhoClicked().getInventory()) {
ItemStack onCursor = event.getCurrentItem();
if (onCursor != null && event.getClickedInventory().getType() != InventoryType.PLAYER){
}else if (
clicked != event.getWhoClicked().getInventory() &&
clicked != null &&
clicked.getType() != InventoryType.PLAYER &&
event.getCursor() != null &&
event.getCursor().getType() != Material.AIR){
event.setCancelled(true);
}
}
}
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {