Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
2413970b32
Commit
95a7b4fd39
@ -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
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren