diff --git a/FightSystem_12/src/de/steamwar/fightsystem/utils/ArrowStopper_12.java b/FightSystem_12/src/de/steamwar/fightsystem/utils/ArrowStopper_12.java
new file mode 100644
index 0000000..e4855ee
--- /dev/null
+++ b/FightSystem_12/src/de/steamwar/fightsystem/utils/ArrowStopper_12.java
@@ -0,0 +1,31 @@
+/*
+ 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.utils;
+
+import org.bukkit.block.Block;
+
+public class ArrowStopper_12 {
+ private ArrowStopper_12(){}
+
+ @SuppressWarnings("deprecation")
+ static int blockToId(Block block){
+ return block.getTypeId() << 4 + block.getData();
+ }
+}
diff --git a/FightSystem_15/src/de/steamwar/fightsystem/utils/ArrowStopper_15.java b/FightSystem_15/src/de/steamwar/fightsystem/utils/ArrowStopper_15.java
new file mode 100644
index 0000000..00aba0a
--- /dev/null
+++ b/FightSystem_15/src/de/steamwar/fightsystem/utils/ArrowStopper_15.java
@@ -0,0 +1,31 @@
+/*
+ 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.utils;
+
+import org.bukkit.block.Block;
+import org.bukkit.craftbukkit.v1_15_R1.block.CraftBlock;
+
+public class ArrowStopper_15 {
+ private ArrowStopper_15(){}
+
+ static int blockToId(Block block){
+ return net.minecraft.server.v1_15_R1.Block.REGISTRY_ID.getId(((CraftBlock)block).getNMS());
+ }
+}
diff --git a/FightSystem_API/src/de/steamwar/fightsystem/Config.java b/FightSystem_API/src/de/steamwar/fightsystem/Config.java
index 524da67..86e1db2 100644
--- a/FightSystem_API/src/de/steamwar/fightsystem/Config.java
+++ b/FightSystem_API/src/de/steamwar/fightsystem/Config.java
@@ -80,6 +80,7 @@ public class Config {
public static final int ArenaMaxX;
public static final int ArenaMaxZ;
public static final boolean GroundWalkable;
+ public static final int ArrowTechhiderCollision;
//schematic parameter
public static final boolean RanksEnabled;
@@ -188,6 +189,7 @@ public class Config {
double teamBlueSpawnOffsetX = worldconfig.getDouble("Arena.SpawnOffset.x");
double teamBlueSpawnOffsetY = worldconfig.getDouble("Arena.SpawnOffset.y");
double teamBlueSpawnOffsetZ = worldconfig.getDouble("Arena.SpawnOffset.z");
+ ArrowTechhiderCollision = config.getInt("Times.ArrowTechhiderCollision");
RanksEnabled = config.getBoolean("Schematic.RanksEnabled");
SchematicType = de.steamwar.sql.SchematicType.fromDB(config.getString("Schematic.SchematicType"));
diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java b/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java
index 9ddb221..b180f56 100644
--- a/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java
+++ b/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java
@@ -32,10 +32,7 @@ import de.steamwar.fightsystem.record.RecordSystem;
import de.steamwar.fightsystem.record.Recorder;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependent;
-import de.steamwar.fightsystem.utils.EnterHandler;
-import de.steamwar.fightsystem.utils.FightScoreboard;
-import de.steamwar.fightsystem.utils.FightStatistics;
-import de.steamwar.fightsystem.utils.TechHider;
+import de.steamwar.fightsystem.utils.*;
import de.steamwar.fightsystem.winconditions.*;
import de.steamwar.sql.EventFight;
import de.steamwar.sql.Schematic;
@@ -72,6 +69,7 @@ public class FightSystem extends JavaPlugin {
TechHider.init();
FightScoreboard.init();
RecordSystem.init();
+ ArrowStopper.init();
try {
CommandRemover.removeAll("gamemode");
diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/utils/ArrowStopper.java b/FightSystem_Main/src/de/steamwar/fightsystem/utils/ArrowStopper.java
new file mode 100644
index 0000000..9fcc647
--- /dev/null
+++ b/FightSystem_Main/src/de/steamwar/fightsystem/utils/ArrowStopper.java
@@ -0,0 +1,86 @@
+/*
+ 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.utils;
+
+import de.steamwar.core.Core;
+import de.steamwar.fightsystem.Config;
+import de.steamwar.fightsystem.FightSystem;
+import de.steamwar.fightsystem.states.FightState;
+import de.steamwar.fightsystem.states.StateDependent;
+import org.bukkit.Bukkit;
+import org.bukkit.block.Block;
+import org.bukkit.entity.AbstractArrow;
+import org.bukkit.entity.Entity;
+import org.bukkit.scheduler.BukkitTask;
+
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.Set;
+
+public class ArrowStopper implements StateDependent {
+
+ private BukkitTask task;
+
+ public static void init() {
+ if(Config.ArrowTechhiderCollision == -1)
+ return;
+ FightSystem.registerStateDependent(new ArrowStopper());
+ }
+
+ private void run() {
+ Collection arrows = Bukkit.getWorlds().get(0).getEntitiesByClasses(AbstractArrow.class);
+ if(arrows.isEmpty())
+ return;
+ for (Entity entity : arrows) {
+ if(entity.getTicksLived() > Config.ArrowTechhiderCollision)
+ continue;
+ if(Config.HiddenBlocks.contains(blockToId(entity.getLocation().getBlock())))
+ entity.remove();
+ }
+ }
+
+ @Override
+ public Set enabled() {
+ return EnumSet.of(FightState.RUNNING);
+ }
+
+ @Override
+ public void enable() {
+ task = Bukkit.getScheduler().runTaskTimerAsynchronously(FightSystem.getPlugin(), this::run, 1, 0);
+ }
+
+ @Override
+ public void disable() {
+ task.cancel();
+ }
+
+ private static int blockToId(Block block){
+ switch(Core.getVersion()){
+ case 8:
+ case 9:
+ case 10:
+ case 12:
+ return ArrowStopper_12.blockToId(block);
+ case 15:
+ default:
+ return ArrowStopper_15.blockToId(block);
+ }
+ }
+}