From 4aee1f4c72628991cc86ddb51bd024bfd9a00ad6 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 1 Feb 2020 14:28:46 +0100 Subject: [PATCH] Preventing arrow pickups Signed-off-by: Lixfel --- .../de/steamwar/fightsystem/FightSystem.java | 3 +++ .../listener/ArrowPickupListener.java | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 FightSystem_Main/src/de/steamwar/fightsystem/listener/ArrowPickupListener.java diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java b/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java index cf3dcfd..e52ca64 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java @@ -1,5 +1,6 @@ package de.steamwar.fightsystem; +import de.steamwar.core.Core; import de.steamwar.fightsystem.commands.*; import de.steamwar.fightsystem.countdown.*; import de.steamwar.fightsystem.fight.Fight; @@ -59,6 +60,8 @@ public class FightSystem extends JavaPlugin { new EventJoinListener(); new TestListener(); new NormalJoinListener(); + if(Core.getVersion() > 8) + new ArrowPickupListener(); new WinconditionAllDead(); new WinconditionCaptainDead(); diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/listener/ArrowPickupListener.java b/FightSystem_Main/src/de/steamwar/fightsystem/listener/ArrowPickupListener.java new file mode 100644 index 0000000..7cbbbd1 --- /dev/null +++ b/FightSystem_Main/src/de/steamwar/fightsystem/listener/ArrowPickupListener.java @@ -0,0 +1,19 @@ +package de.steamwar.fightsystem.listener; + +import de.steamwar.fightsystem.states.FightState; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerPickupArrowEvent; + +import java.util.EnumSet; + +public class ArrowPickupListener extends BasicListener { + + public ArrowPickupListener() { + super(EnumSet.allOf(FightState.class)); + } + + @EventHandler + public void onArrowPickup(PlayerPickupArrowEvent e){ + e.setCancelled(true); + } +}