diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java
index cc59977..f4730f8 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java
@@ -22,12 +22,11 @@ package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
+import de.steamwar.bausystem.tracer.show.ShowModeParameter;
import de.steamwar.bausystem.tracer.show.StoredRecords;
import de.steamwar.bausystem.tracer.show.TraceShowManager;
import de.steamwar.bausystem.tracer.show.mode.Advanced;
-import de.steamwar.bausystem.tracer.show.mode.AdvancedNoWater;
import de.steamwar.bausystem.tracer.show.mode.Basic;
-import de.steamwar.bausystem.tracer.show.mode.BasicNoWater;
import de.steamwar.bausystem.world.Welt;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@@ -89,25 +88,17 @@ public class CommandTrace implements CommandExecutor {
break;
case "show":
if (args.length < 2) {
- TraceShowManager.show(player, new Basic(player));
+ TraceShowManager.show(player, new Basic(player, new ShowModeParameter()));
} else {
+ ShowModeParameter showModeParameter = ShowModeParameter.parseArguments(args, 2);
switch (args[1].toLowerCase()) {
- case "nowater":
- case "basic-nowater":
- case "basicnowater":
- TraceShowManager.show(player, new BasicNoWater(player));
- break;
case "advanced":
- TraceShowManager.show(player, new Advanced(player));
- break;
- case "advanced-nowater":
- case "advancednowater":
- TraceShowManager.show(player, new AdvancedNoWater(player));
+ TraceShowManager.show(player, new Advanced(player, showModeParameter));
break;
case "basic":
case "default":
default:
- TraceShowManager.show(player, new Basic(player));
+ TraceShowManager.show(player, new Basic(player, showModeParameter));
break;
}
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java
index 16d2970..5efe116 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTraceTabCompleter.java
@@ -39,7 +39,9 @@ public class CommandTraceTabCompleter implements TabCompleter {
tabCompletes.add(new TabComplete((player, args) -> args.length == 1 && (RecordStateMachine.getRecordStatus() == RecordStatus.IDLE || RecordStateMachine.getRecordStatus() == RecordStatus.IDLE_AUTO), "start"));
tabCompletes.add(new TabComplete((player, args) -> args.length == 1 && (RecordStateMachine.getRecordStatus() != RecordStatus.IDLE && RecordStateMachine.getRecordStatus() != RecordStatus.IDLE_AUTO), "stop"));
tabCompletes.add(new TabComplete((player, args) -> args.length == 1, "toggleauto", "auto", "show", "hide", "delete", "clear"));
- tabCompletes.add(new TabComplete((player, args) -> args.length == 2 && args[0].equalsIgnoreCase("show"), "nowater", "basic", "advanced", "advanced-nowater"));
+ tabCompletes.add(new TabComplete((player, args) -> args.length == 2 && args[0].equalsIgnoreCase("show"), "basic", "advanced"));
+ tabCompletes.add(new TabComplete((player, args) -> args.length > 2 && args[0].equalsIgnoreCase("show") && (args[1].equalsIgnoreCase("basic") || args[1].equalsIgnoreCase("advanced")), "-water"));
+ tabCompletes.add(new TabComplete((player, args) -> args.length > 2 && args[0].equalsIgnoreCase("show") && args[1].equalsIgnoreCase("advanced"), "-interpolate-xz", "-interpolate-y"));
}
@Override
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowMode.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowMode.java
index c3ad9da..5a96232 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowMode.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowMode.java
@@ -1,3 +1,22 @@
+/*
+ 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;
import de.steamwar.bausystem.tracer.TNTPosition;
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java
new file mode 100644
index 0000000..e3ee044
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/ShowModeParameter.java
@@ -0,0 +1,89 @@
+/*
+ *
+ * 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;
+
+public class ShowModeParameter {
+
+ private boolean water = false;
+ private boolean interpolate_SET = false;
+ private boolean interpolate_Y = true;
+ private boolean interpolate_XZ = true;
+
+ public ShowModeParameter() {
+
+ }
+
+ public boolean isWater() {
+ return water;
+ }
+
+ public boolean isInterpolate_Y() {
+ return interpolate_Y;
+ }
+
+ public boolean isInterpolate_XZ() {
+ return interpolate_XZ;
+ }
+
+ public static ShowModeParameter parseArguments(String[] args, int index) {
+ ShowModeParameter showModeParameter = new ShowModeParameter();
+ for (int i = index; i < args.length; i++) {
+ switch (args[i].toLowerCase()) {
+ case "-water":
+ showModeParameter.water = true;
+ break;
+ case "-interpolatey":
+ case "-interpolate-y":
+ case "-interpolate_y":
+ case "-y":
+ if (showModeParameter.interpolate_SET) {
+ showModeParameter.interpolate_Y = true;
+ } else {
+ showModeParameter.interpolate_XZ = false;
+ showModeParameter.interpolate_SET = true;
+ }
+ break;
+ case "-interpolatex":
+ case "-interpolate-x":
+ case "-interpolate_x":
+ case "-x":
+ case "-interpolatez":
+ case "-interpolate-z":
+ case "-interpolate_z":
+ case "-z":
+ case "-interpolatexz":
+ case "-interpolate-xz":
+ case "-interpolate_xz":
+ case "-xz":
+ if (showModeParameter.interpolate_SET) {
+ showModeParameter.interpolate_XZ = true;
+ } else {
+ showModeParameter.interpolate_Y = false;
+ showModeParameter.interpolate_SET = true;
+ }
+ break;
+ }
+ }
+ return showModeParameter;
+ }
+
+}
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
index 34fa854..c9bf35a 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Advanced.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Advanced.java
@@ -24,6 +24,7 @@ package de.steamwar.bausystem.tracer.show.mode;
import de.steamwar.bausystem.tracer.AbstractTraceEntity;
import de.steamwar.bausystem.tracer.RoundedTNTPosition;
import de.steamwar.bausystem.tracer.TNTPosition;
+import de.steamwar.bausystem.tracer.show.ShowModeParameter;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@@ -34,8 +35,8 @@ public class Advanced extends Basic {
private Map updateEntityMap = new HashMap<>();
- public Advanced(Player player) {
- super(player);
+ public Advanced(Player player, ShowModeParameter showModeParameter) {
+ super(player, showModeParameter);
}
@Override
@@ -53,19 +54,17 @@ public class Advanced extends Basic {
updatePointXZ = updatePointY.clone().setZ(position.getLocation().getZ());
}
- if (!position.getLocation().equals(updatePointY)) {
+ if (showModeParameter.isInterpolate_Y() && !position.getLocation().equals(updatePointY)) {
RoundedTNTPosition updatePointPosition = new RoundedTNTPosition(updatePointY);
- if (updateEntityMap.containsKey(updatePointPosition)) {
- return;
+ if (!updateEntityMap.containsKey(updatePointPosition)) {
+ updateEntityMap.put(updatePointPosition, createEntity(updatePointY, false, false));
}
- updateEntityMap.put(updatePointPosition, createEntity(updatePointY, false, false));
}
- if (!position.getLocation().equals(updatePointXZ)) {
+ if (showModeParameter.isInterpolate_XZ() && !position.getLocation().equals(updatePointXZ)) {
RoundedTNTPosition updatePointPosition = new RoundedTNTPosition(updatePointXZ);
- if (updateEntityMap.containsKey(updatePointPosition)) {
- return;
+ if (!updateEntityMap.containsKey(updatePointPosition)) {
+ updateEntityMap.put(updatePointPosition, createEntity(updatePointXZ, false, false));
}
- updateEntityMap.put(updatePointPosition, createEntity(updatePointXZ, false, false));
}
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/AdvancedNoWater.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/AdvancedNoWater.java
deleted file mode 100644
index afbde3f..0000000
--- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/AdvancedNoWater.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * 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.VersionedCallable;
-import org.bukkit.Bukkit;
-import org.bukkit.World;
-import org.bukkit.entity.Player;
-
-public class AdvancedNoWater extends Advanced {
-
- private static final World world = Bukkit.getWorlds().get(0);
-
- public AdvancedNoWater(Player player) {
- super(player);
- }
-
- @SuppressWarnings({"java:S5411"})
- @Override
- public void show(TNTPosition position) {
- if (VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_12.inWater(world, position.getLocation()), 8),
- new VersionedCallable<>(() -> TNTTracer_15.inWater(world, position.getLocation()), 14))) {
- return;
- }
- super.show(position);
- }
-
-}
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
index 02131db..6ff527f 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Basic.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Basic.java
@@ -2,6 +2,7 @@ package de.steamwar.bausystem.tracer.show.mode;
import de.steamwar.bausystem.tracer.*;
import de.steamwar.bausystem.tracer.show.ShowMode;
+import de.steamwar.bausystem.tracer.show.ShowModeParameter;
import de.steamwar.core.VersionedCallable;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@@ -12,15 +13,20 @@ import java.util.Map;
public class Basic implements ShowMode {
protected final Player player;
+ protected final ShowModeParameter showModeParameter;
private Map tntEntityMap = new HashMap<>();
- public Basic(Player player) {
+ public Basic(Player player, ShowModeParameter showModeParameter) {
this.player = player;
+ this.showModeParameter = showModeParameter;
}
@Override
public void show(TNTPosition position) {
+ if (showModeParameter.isWater() && checkWater(position.getLocation())) {
+ return;
+ }
RoundedTNTPosition roundedTNTPosition = new RoundedTNTPosition(position);
if (tntEntityMap.containsKey(roundedTNTPosition)) {
return;
@@ -28,6 +34,11 @@ public class Basic implements ShowMode {
tntEntityMap.put(roundedTNTPosition, createEntity(position.getLocation(), position.isExploded(), true));
}
+ protected boolean checkWater(Vector position) {
+ return (VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_12.inWater(player.getWorld(), position), 8),
+ new VersionedCallable<>(() -> TNTTracer_15.inWater(player.getWorld(), position), 14)));
+ }
+
protected AbstractTraceEntity createEntity(Vector position, boolean exploded, boolean tnt) {
return VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_12.create(player.getWorld(), position, player, exploded, tnt), 8),
new VersionedCallable<>(() -> TNTTracer_15.create(player.getWorld(), position, player, exploded, tnt), 14));
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
deleted file mode 100644
index fc19b8a..0000000
--- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/BasicNoWater.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * 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.VersionedCallable;
-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);
- }
-
- @SuppressWarnings({"java:S5411"})
- @Override
- public void show(TNTPosition position) {
- if (VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_12.inWater(world, position.getLocation()), 8),
- new VersionedCallable<>(() -> TNTTracer_15.inWater(world, position.getLocation()), 14))) {
- return;
- }
- super.show(position);
- }
-
-}