diff --git a/FightSystem_10/src/de/steamwar/fightsystem/listener/DenyWorldInteraction_10.java b/FightSystem_10/src/de/steamwar/fightsystem/listener/DenyWorldInteraction_10.java new file mode 100644 index 0000000..5a805c9 --- /dev/null +++ b/FightSystem_10/src/de/steamwar/fightsystem/listener/DenyWorldInteraction_10.java @@ -0,0 +1,32 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2020 SteamWar.de-Serverteam + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ + +package de.steamwar.fightsystem.listener; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerSwapHandItemsEvent; + +public class DenyWorldInteraction_10 implements Listener { + + @EventHandler + public void onSwapItems(PlayerSwapHandItemsEvent event) { + event.setCancelled(true); + } +} diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/listener/DenyWorldInteraction.java b/FightSystem_Main/src/de/steamwar/fightsystem/listener/DenyWorldInteraction.java index ca0d01c..78b5d50 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/listener/DenyWorldInteraction.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/listener/DenyWorldInteraction.java @@ -19,6 +19,7 @@ package de.steamwar.fightsystem.listener; +import de.steamwar.core.Core; import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.StateDependentListener; @@ -39,6 +40,11 @@ public class DenyWorldInteraction implements Listener { public DenyWorldInteraction() { new StateDependentListener(ArenaMode.Test, FightState.PreRunning, this); new StateDependentListener(ArenaMode.AntiTest, FightState.AntiRunning, this); + if(Core.getVersion() > 9){ + Listener listener = new DenyWorldInteraction_10(); + new StateDependentListener(ArenaMode.Test, FightState.PreRunning, listener); + new StateDependentListener(ArenaMode.AntiTest, FightState.AntiRunning, listener); + } } @EventHandler @@ -68,13 +74,13 @@ public class DenyWorldInteraction implements Listener { @EventHandler public void onInventoryClick(InventoryClickEvent event) { - if(PersonalKitCreator.notInKitCreator(event.getWhoClicked())) + if(!PersonalKitCreator.inKitCreator(event.getWhoClicked())) event.setCancelled(true); } @EventHandler public void onInventoryDrag(InventoryDragEvent event) { - if(PersonalKitCreator.notInKitCreator(event.getWhoClicked())) + if(!PersonalKitCreator.inKitCreator(event.getWhoClicked())) event.setCancelled(true); } diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/listener/HotbarGUI.java b/FightSystem_Main/src/de/steamwar/fightsystem/listener/HotbarGUI.java index 2827c50..6b52db4 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/listener/HotbarGUI.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/listener/HotbarGUI.java @@ -42,9 +42,10 @@ public class HotbarGUI implements Listener { public void handlePlayerInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); - if(!PersonalKitCreator.notInKitCreator(player)) + if(PersonalKitCreator.inKitCreator(player)) return; + event.setCancelled(true); if(event.getItem() == null) return; @@ -52,7 +53,6 @@ public class HotbarGUI implements Listener { if(fightTeam == null) return; - event.setCancelled(true); ItemMeta itemMeta = event.getItem().getItemMeta(); String displayName = itemMeta.getDisplayName(); diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/listener/PersonalKitCreator.java b/FightSystem_Main/src/de/steamwar/fightsystem/listener/PersonalKitCreator.java index 3007ee1..297834f 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/listener/PersonalKitCreator.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/listener/PersonalKitCreator.java @@ -61,8 +61,8 @@ public class PersonalKitCreator implements Listener { BasicListener.toActionbar(player, TextComponent.fromLegacyText("§eInventar zum Anpassen des Kits öffnen§8!")); } - public static boolean notInKitCreator(HumanEntity player){ - return !openKitCreators.containsKey(player); + public static boolean inKitCreator(HumanEntity player){ + return openKitCreators.containsKey(player); } public static void closeIfInKitCreator(HumanEntity player){