SteamWar/FightSystem
Archiviert
13
1

Hotfix inventory
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2021-11-09 11:05:32 +01:00
Ursprung 2413970b32
Commit 95a7b4fd39

Datei anzeigen

@ -30,8 +30,14 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.inventory.InventoryType;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Set;
public class InFightInventory implements Listener {
private static final Set<Material> allowed = Collections.unmodifiableSet(EnumSet.of(Material.TNT, Material.AIR));
public InFightInventory() {
new StateDependentListener(ArenaMode.AntiReplay, FightState.Ingame, this);
}
@ -42,7 +48,7 @@ public class InFightInventory implements Listener {
if(top == InventoryType.CRAFTING)
return;
if ((event.getCursor() != null && event.getCursor().getType() != Material.TNT) || (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.TNT))
if ((event.getCursor() != null && !allowed.contains(event.getCursor().getType())) || (event.getCurrentItem() != null && !allowed.contains(event.getCurrentItem().getType())))
event.setCancelled(true); // Deny if transferred item is not TNT
}