Fixing inventory item handling
Dieser Commit ist enthalten in:
Ursprung
d430311693
Commit
e61ef0ba66
@ -2,6 +2,7 @@ package me.yaruma.fightsystem.listener;
|
|||||||
|
|
||||||
import me.yaruma.fightsystem.FightSystem;
|
import me.yaruma.fightsystem.FightSystem;
|
||||||
import me.yaruma.fightsystem.fight.FightState;
|
import me.yaruma.fightsystem.fight.FightState;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
@ -26,12 +27,13 @@ public class InventoryListener implements Listener {
|
|||||||
if (clickedOn != null && event.getView().getTopInventory().getType() != InventoryType.CRAFTING && clicked == event.getWhoClicked().getInventory()) {
|
if (clickedOn != null && event.getView().getTopInventory().getType() != InventoryType.CRAFTING && clicked == event.getWhoClicked().getInventory()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}else if (clicked != event.getWhoClicked().getInventory()) {
|
}else if (
|
||||||
ItemStack onCursor = event.getCurrentItem();
|
clicked != event.getWhoClicked().getInventory() &&
|
||||||
|
clicked != null &&
|
||||||
if (onCursor != null && event.getClickedInventory().getType() != InventoryType.PLAYER){
|
clicked.getType() != InventoryType.PLAYER &&
|
||||||
event.setCancelled(true);
|
event.getCursor() != null &&
|
||||||
}
|
event.getCursor().getType() != Material.AIR){
|
||||||
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren