diff --git a/BauSystem_15/src/de/steamwar/bausystem/tracer/TNTEntityFactory_15.java b/BauSystem_12/src/de/steamwar/bausystem/tracer/TNTTracer_12.java
similarity index 57%
rename from BauSystem_15/src/de/steamwar/bausystem/tracer/TNTEntityFactory_15.java
rename to BauSystem_12/src/de/steamwar/bausystem/tracer/TNTTracer_12.java
index 0fc1ac8..94dc43d 100644
--- a/BauSystem_15/src/de/steamwar/bausystem/tracer/TNTEntityFactory_15.java
+++ b/BauSystem_12/src/de/steamwar/bausystem/tracer/TNTTracer_12.java
@@ -19,13 +19,23 @@
package de.steamwar.bausystem.tracer;
+import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
-public class TNTEntityFactory_15 {
+public class TNTTracer_12 {
- public static AbstractTNTEntity create(World world, TNTPosition tntPosition, Player player) {
- return new TNTEntity_15(world, tntPosition, player);
+ public static AbstractTraceEntity createTNT(World world, TNTPosition tntPosition, Player player) {
+ return new TraceEntity_12(world, tntPosition, player);
+ }
+
+ public static AbstractTraceEntity createUpdatePoint(World world, TNTPosition tntPosition, Player player) {
+ return new UpdateEntity_12(world, tntPosition, player);
+ }
+
+ public static boolean inWater(World world, TNTPosition tntPosition) {
+ Material material = tntPosition.getLocation().toLocation(world).getBlock().getType();
+ return material == Material.WATER || material == Material.STATIONARY_WATER;
}
}
diff --git a/BauSystem_12/src/de/steamwar/bausystem/tracer/TNTEntity_12.java b/BauSystem_12/src/de/steamwar/bausystem/tracer/TraceEntity_12.java
similarity index 91%
rename from BauSystem_12/src/de/steamwar/bausystem/tracer/TNTEntity_12.java
rename to BauSystem_12/src/de/steamwar/bausystem/tracer/TraceEntity_12.java
index ce11c08..59ed8bd 100644
--- a/BauSystem_12/src/de/steamwar/bausystem/tracer/TNTEntity_12.java
+++ b/BauSystem_12/src/de/steamwar/bausystem/tracer/TraceEntity_12.java
@@ -25,11 +25,11 @@ import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
-class TNTEntity_12 extends EntityFallingBlock implements AbstractTNTEntity {
+class TraceEntity_12 extends EntityFallingBlock implements AbstractTraceEntity {
private TNTPosition position;
- public TNTEntity_12(World world, TNTPosition position, Player player) {
+ public TraceEntity_12(World world, TNTPosition position, Player player) {
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
this.position = position;
@@ -47,7 +47,7 @@ class TNTEntity_12 extends EntityFallingBlock implements AbstractTNTEntity {
}
@Override
- public AbstractTNTEntity display(Player player) {
+ public AbstractTraceEntity display(Player player) {
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this, 0);
ReflectionUtils.setValue("c", packetPlayOutSpawnEntity, position.getLocation().getX());
ReflectionUtils.setValue("d", packetPlayOutSpawnEntity, position.getLocation().getY());
@@ -67,7 +67,7 @@ class TNTEntity_12 extends EntityFallingBlock implements AbstractTNTEntity {
}
@Override
- public AbstractTNTEntity hide(Player player) {
+ public AbstractTraceEntity hide(Player player) {
PacketPlayOutEntityDestroy packetPlayOutEntityDestroy = new PacketPlayOutEntityDestroy(new int[]{getId()});
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityDestroy);
diff --git a/BauSystem_12/src/de/steamwar/bausystem/tracer/UpdateEntity_12.java b/BauSystem_12/src/de/steamwar/bausystem/tracer/UpdateEntity_12.java
new file mode 100644
index 0000000..2cd3272
--- /dev/null
+++ b/BauSystem_12/src/de/steamwar/bausystem/tracer/UpdateEntity_12.java
@@ -0,0 +1,84 @@
+/*
+ *
+ * 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.bausystem.tracer;
+
+import net.minecraft.server.v1_12_R1.*;
+import org.bukkit.World;
+import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
+import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
+import org.bukkit.entity.Player;
+
+class UpdateEntity_12 extends EntityFallingBlock implements AbstractTraceEntity {
+
+ private TNTPosition position;
+
+ public UpdateEntity_12(World world, TNTPosition position, Player player) {
+ super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.STAINED_GLASS.getBlockData());
+ this.position = position;
+
+ this.setNoGravity(true);
+ this.ticksLived = -12000;
+ this.dropItem = false;
+ this.setCustomNameVisible(true);
+
+ display(player);
+ }
+
+ @Override
+ public void move(EnumMoveType enummovetype, double dx, double dy, double dz) {
+
+ }
+
+ @Override
+ public AbstractTraceEntity display(Player player) {
+ PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this, 0);
+ ReflectionUtils.setValue("c", packetPlayOutSpawnEntity, position.getLocation().getX());
+ ReflectionUtils.setValue("d", packetPlayOutSpawnEntity, position.getLocation().getY());
+ ReflectionUtils.setValue("e", packetPlayOutSpawnEntity, position.getLocation().getZ());
+ ReflectionUtils.setValue("f", packetPlayOutSpawnEntity, 0);
+ ReflectionUtils.setValue("g", packetPlayOutSpawnEntity, 0);
+ ReflectionUtils.setValue("h", packetPlayOutSpawnEntity, 0);
+ ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutSpawnEntity);
+
+ PacketPlayOutEntityTeleport packetPlayOutEntityTeleport = new PacketPlayOutEntityTeleport(this);
+ ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityTeleport);
+
+ PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
+ ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityMetadata);
+
+ return this;
+ }
+
+ @Override
+ public AbstractTraceEntity hide(Player player) {
+ PacketPlayOutEntityDestroy packetPlayOutEntityDestroy = new PacketPlayOutEntityDestroy(new int[]{getId()});
+ ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityDestroy);
+
+ return this;
+ }
+
+ @Override
+ public void remove() {
+ killEntity();
+ }
+
+}
diff --git a/BauSystem_12/src/de/steamwar/bausystem/tracer/TNTEntityFactory_12.java b/BauSystem_15/src/de/steamwar/bausystem/tracer/TNTTracer_15.java
similarity index 58%
rename from BauSystem_12/src/de/steamwar/bausystem/tracer/TNTEntityFactory_12.java
rename to BauSystem_15/src/de/steamwar/bausystem/tracer/TNTTracer_15.java
index 794fbc4..823ea7a 100644
--- a/BauSystem_12/src/de/steamwar/bausystem/tracer/TNTEntityFactory_12.java
+++ b/BauSystem_15/src/de/steamwar/bausystem/tracer/TNTTracer_15.java
@@ -19,13 +19,23 @@
package de.steamwar.bausystem.tracer;
+import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
-public class TNTEntityFactory_12 {
+public class TNTTracer_15 {
- public static AbstractTNTEntity create(World world, TNTPosition tntPosition, Player player) {
- return new TNTEntity_12(world, tntPosition, player);
+ public static AbstractTraceEntity createTNT(World world, TNTPosition tntPosition, Player player) {
+ return new TraceEntity_15(world, tntPosition, player);
+ }
+
+ public static AbstractTraceEntity createUpdatePoint(World world, TNTPosition tntPosition, Player player) {
+ return new UpdateEntity_15(world, tntPosition, player);
+ }
+
+ public static boolean inWater(World world, TNTPosition tntPosition) {
+ Material material = tntPosition.getLocation().toLocation(world).getBlock().getType();
+ return material == Material.WATER;
}
}
diff --git a/BauSystem_15/src/de/steamwar/bausystem/tracer/TNTEntity_15.java b/BauSystem_15/src/de/steamwar/bausystem/tracer/TraceEntity_15.java
similarity index 90%
rename from BauSystem_15/src/de/steamwar/bausystem/tracer/TNTEntity_15.java
rename to BauSystem_15/src/de/steamwar/bausystem/tracer/TraceEntity_15.java
index 00de470..303a191 100644
--- a/BauSystem_15/src/de/steamwar/bausystem/tracer/TNTEntity_15.java
+++ b/BauSystem_15/src/de/steamwar/bausystem/tracer/TraceEntity_15.java
@@ -25,12 +25,12 @@ import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
-class TNTEntity_15 extends EntityFallingBlock implements AbstractTNTEntity {
+class TraceEntity_15 extends EntityFallingBlock implements AbstractTraceEntity {
private static final Vec3D ZERO = new Vec3D(0, 0, 0);
private TNTPosition position;
- public TNTEntity_15(World world, TNTPosition position, Player player) {
+ public TraceEntity_15(World world, TNTPosition position, Player player) {
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
this.position = position;
@@ -48,7 +48,7 @@ class TNTEntity_15 extends EntityFallingBlock implements AbstractTNTEntity {
}
@Override
- public AbstractTNTEntity display(Player player) {
+ public AbstractTraceEntity display(Player player) {
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(getId(), getUniqueID(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), 0, 0, EntityTypes.FALLING_BLOCK, Block.getCombinedId(Blocks.TNT.getBlockData()), ZERO);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutSpawnEntity);
@@ -59,7 +59,7 @@ class TNTEntity_15 extends EntityFallingBlock implements AbstractTNTEntity {
}
@Override
- public AbstractTNTEntity hide(Player player) {
+ public AbstractTraceEntity hide(Player player) {
PacketPlayOutEntityDestroy packetPlayOutEntityDestroy = new PacketPlayOutEntityDestroy(new int[]{getId()});
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityDestroy);
diff --git a/BauSystem_15/src/de/steamwar/bausystem/tracer/UpdateEntity_15.java b/BauSystem_15/src/de/steamwar/bausystem/tracer/UpdateEntity_15.java
new file mode 100644
index 0000000..8fa1f70
--- /dev/null
+++ b/BauSystem_15/src/de/steamwar/bausystem/tracer/UpdateEntity_15.java
@@ -0,0 +1,76 @@
+/*
+ *
+ * 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.bausystem.tracer;
+
+import net.minecraft.server.v1_15_R1.*;
+import org.bukkit.World;
+import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
+import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
+import org.bukkit.entity.Player;
+
+class UpdateEntity_15 extends EntityFallingBlock implements AbstractTraceEntity {
+
+ private static final Vec3D ZERO = new Vec3D(0, 0, 0);
+ private TNTPosition position;
+
+ public UpdateEntity_15(World world, TNTPosition position, Player player) {
+ super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
+ this.position = position;
+
+ this.setNoGravity(true);
+ this.ticksLived = -12000;
+ this.dropItem = false;
+ this.setCustomNameVisible(true);
+
+ display(player);
+ }
+
+ @Override
+ public void move(EnumMoveType enummovetype, Vec3D vec3d) {
+
+ }
+
+ @Override
+ public AbstractTraceEntity display(Player player) {
+ PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(getId(), getUniqueID(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), 0, 0, EntityTypes.FALLING_BLOCK, Block.getCombinedId(Blocks.WHITE_STAINED_GLASS.getBlockData()), ZERO);
+ ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutSpawnEntity);
+
+ PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
+ ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityMetadata);
+
+ return this;
+ }
+
+ @Override
+ public AbstractTraceEntity hide(Player player) {
+ PacketPlayOutEntityDestroy packetPlayOutEntityDestroy = new PacketPlayOutEntityDestroy(new int[]{getId()});
+ ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityDestroy);
+
+ return this;
+ }
+
+ @Override
+ public void remove() {
+ killEntity();
+ }
+
+}
diff --git a/BauSystem_API/src/de/steamwar/bausystem/tracer/AbstractTNTEntity.java b/BauSystem_API/src/de/steamwar/bausystem/tracer/AbstractTraceEntity.java
similarity index 86%
rename from BauSystem_API/src/de/steamwar/bausystem/tracer/AbstractTNTEntity.java
rename to BauSystem_API/src/de/steamwar/bausystem/tracer/AbstractTraceEntity.java
index d39751f..1ff6886 100644
--- a/BauSystem_API/src/de/steamwar/bausystem/tracer/AbstractTNTEntity.java
+++ b/BauSystem_API/src/de/steamwar/bausystem/tracer/AbstractTraceEntity.java
@@ -21,11 +21,11 @@ package de.steamwar.bausystem.tracer;
import org.bukkit.entity.Player;
-public interface AbstractTNTEntity {
+public interface AbstractTraceEntity {
- AbstractTNTEntity display(Player player);
+ AbstractTraceEntity display(Player player);
- AbstractTNTEntity hide(Player player);
+ AbstractTraceEntity hide(Player player);
void remove();
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java
index 983f726..f553a2d 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java
@@ -84,15 +84,11 @@ public class CommandTrace implements CommandExecutor {
player.sendMessage(BauSystem.PREFIX + "§cAlle TNT-Positionen gelöscht");
break;
case "show":
- TraceShowManager.show(player);
+ TraceShowManager.show(player, args);
break;
case "hide":
TraceShowManager.hide(player);
break;
- case "toggleshow":
- case "interpolate":
- case "distance":
- break;
case "list":
case "gui":
break;
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java
index 9c32567..1f3a699 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java
@@ -21,6 +21,8 @@ package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
import de.steamwar.bausystem.tracer.record.RecordStatus;
+import de.steamwar.bausystem.tracer.show.mode.Basic;
+import de.steamwar.bausystem.tracer.show.mode.BasicNoWater;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
@@ -47,21 +49,13 @@ public class CommandTraceTabCompleter implements TabCompleter {
}
tabComplete.add("toggleauto");
tabComplete.add("auto");
- tabComplete.add("toggleshow");
tabComplete.add("show");
if (args[0].equalsIgnoreCase("show") && args.length == 2) {
- return manageList(new ArrayList<>(Arrays.asList("block", "particle")), args, 1);
+ return manageList(new ArrayList<>(Arrays.asList("water", "nowater", "no_water", "removedwater", "removed_water", "basic", "default")), args, 1);
}
tabComplete.add("hide");
tabComplete.add("delete");
- tabComplete.add("interpolate");
- if (args[0].equalsIgnoreCase("interpolate") && args.length == 2) {
- return manageList(new ArrayList<>(Arrays.asList("all", "yaxis", "none")), args, 1);
- }
- tabComplete.add("distance");
- if (args[0].equalsIgnoreCase("distance") && args.length == 2) {
- return manageList(new ArrayList<>(Arrays.asList("3", "4", "5", "6", "7", "8", "9", "10", "11", "default")), args, 1);
- }
+ tabComplete.add("clear");
//tabComplete.add("gui");
//tabComplete.add("list");
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/record/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/record/Recorder.java
index 8aeaa43..ea0252e 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/record/Recorder.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/record/Recorder.java
@@ -45,6 +45,11 @@ public class Recorder implements Listener {
Bukkit.getPluginManager().registerEvents(this, BauSystem.getPlugin());
task = Bukkit.getScheduler().runTaskTimer(BauSystem.getPlugin(), this::run, 1, 1);
record = new Record();
+
+ // To trace TNT initial positions with AutoTracer
+ if (RecordStateMachine.getRecordStatus() == RecordStatus.IDLE_AUTO) {
+ run();
+ }
}
void stopRecording() {
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/TraceShowManager.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/TraceShowManager.java
index c931eed..c9fb65f 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/TraceShowManager.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/TraceShowManager.java
@@ -2,7 +2,8 @@ package de.steamwar.bausystem.tracer.show;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.tracer.TNTPosition;
-import de.steamwar.bausystem.tracer.show.mode.BasicShowMode;
+import de.steamwar.bausystem.tracer.show.mode.Basic;
+import de.steamwar.bausystem.tracer.show.mode.BasicNoWater;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -17,9 +18,30 @@ public class TraceShowManager implements Listener {
private static final Map showModes = new HashMap<>();
- public static void show(Player player) {
+ public static void show(Player player, String[] args) {
hide(player);
- ShowMode showMode = new BasicShowMode(player);
+
+ ShowMode showMode;
+ if (args.length < 2) {
+ showMode = new Basic(player);
+ } else {
+ switch (args[1].toLowerCase()) {
+ case "water":
+ case "nowater":
+ case "no_water":
+ case "removedwater":
+ case "removed_water":
+ showMode = new BasicNoWater(player);
+ break;
+ case "basic":
+ case "default":
+ default:
+ showMode = new Basic(player);
+ break;
+ }
+ }
+
+ showModes.put(player, showMode);
StoredRecords.showAll(showMode);
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Advanced.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Advanced.java
new file mode 100644
index 0000000..61afa4a
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Advanced.java
@@ -0,0 +1,25 @@
+/*
+ *
+ * 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.bausystem.tracer.show.mode;
+
+public class Advanced {
+}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Basic.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Basic.java
new file mode 100644
index 0000000..de1e69b
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Basic.java
@@ -0,0 +1,81 @@
+package de.steamwar.bausystem.tracer.show.mode;
+
+import de.steamwar.bausystem.tracer.*;
+import de.steamwar.bausystem.tracer.show.ShowMode;
+import de.steamwar.core.Core;
+import org.bukkit.entity.Player;
+
+import java.util.*;
+
+public class Basic implements ShowMode {
+
+ private final Player player;
+
+ private Map tntEntityMap = new HashMap<>();
+
+ public Basic(Player player) {
+ this.player = player;
+ }
+
+ @Override
+ public void show(TNTPosition position) {
+ RoundedTNTPosition roundedTNTPosition = new RoundedTNTPosition(position);
+ if (tntEntityMap.containsKey(roundedTNTPosition)) {
+ return;
+ }
+
+ switch (Core.getVersion()) {
+ case 12:
+ tntEntityMap.put(roundedTNTPosition, TNTTracer_12.createTNT(player.getWorld(), position, player));
+ break;
+ default:
+ tntEntityMap.put(roundedTNTPosition, TNTTracer_15.createTNT(player.getWorld(), position, player));
+ break;
+ }
+ }
+
+ @Override
+ public void hide() {
+ tntEntityMap.forEach((roundedTNTPosition, abstractTNTEntity) -> {
+ abstractTNTEntity.hide(player);
+ abstractTNTEntity.remove();
+ });
+ tntEntityMap.clear();
+ }
+
+ private static class RoundedTNTPosition {
+
+ private static final int factor = 10;
+
+ private int x;
+ private int y;
+ private int z;
+
+ private RoundedTNTPosition(TNTPosition tntPosition) {
+ this(tntPosition.getLocation().getX(), tntPosition.getLocation().getY(), tntPosition.getLocation().getZ());
+ }
+
+ private RoundedTNTPosition(double x, double y, double z) {
+ this.x = (int)(x * factor);
+ this.y = (int)(y * factor);
+ this.z = (int)(z * factor);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof RoundedTNTPosition)) return false;
+ RoundedTNTPosition that = (RoundedTNTPosition) o;
+ return x == that.x &&
+ y == that.y &&
+ z == that.z;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(x, y, z);
+ }
+
+ }
+
+}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/BasicNoWater.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/BasicNoWater.java
new file mode 100644
index 0000000..c51ab87
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/BasicNoWater.java
@@ -0,0 +1,61 @@
+/*
+ *
+ * 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.bausystem.tracer.show.mode;
+
+import de.steamwar.bausystem.tracer.TNTPosition;
+import de.steamwar.bausystem.tracer.TNTTracer_12;
+import de.steamwar.bausystem.tracer.TNTTracer_15;
+import de.steamwar.core.Core;
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+import org.bukkit.entity.Player;
+
+public class BasicNoWater extends Basic {
+
+ private static final World world = Bukkit.getWorlds().get(0);
+
+ public BasicNoWater(Player player) {
+ super(player);
+ }
+
+ @Override
+ public void show(TNTPosition position) {
+ boolean b;
+ switch (Core.getVersion()) {
+ case 12:
+ b = TNTTracer_12.inWater(world, position);
+ break;
+ default:
+ b = TNTTracer_15.inWater(world, position);
+ break;
+ }
+ if (!b) {
+ super.show(position);
+ }
+ }
+
+ @Override
+ public void hide() {
+ super.hide();
+ }
+
+}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/BasicShowMode.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/BasicShowMode.java
deleted file mode 100644
index 8819135..0000000
--- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/BasicShowMode.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package de.steamwar.bausystem.tracer.show.mode;
-
-import de.steamwar.bausystem.tracer.*;
-import de.steamwar.bausystem.tracer.show.ShowMode;
-import de.steamwar.core.Core;
-import org.bukkit.entity.Player;
-
-import java.util.HashSet;
-import java.util.Set;
-
-public class BasicShowMode implements ShowMode {
-
- private final Player player;
-
- private Set tntEntitySet = new HashSet<>();
-
- public BasicShowMode(Player player) {
- this.player = player;
- }
-
- @Override
- public void show(TNTPosition position) {
- switch (Core.getVersion()) {
- case 12:
- tntEntitySet.add(TNTEntityFactory_12.create(player.getWorld(), position, player));
- break;
- default:
- tntEntitySet.add(TNTEntityFactory_15.create(player.getWorld(), position, player));
- break;
- }
- }
-
- @Override
- public void hide() {
- tntEntitySet.forEach(abstractTNTEntity -> abstractTNTEntity.hide(player));
- tntEntitySet.forEach(AbstractTNTEntity::remove);
- tntEntitySet.clear();
- }
-
-}