diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties
index d35f51de..6088b39f 100644
--- a/BauSystem_Main/src/BauSystem.properties
+++ b/BauSystem_Main/src/BauSystem.properties
@@ -251,6 +251,18 @@ TRACE_SHOW_GUI_INTERPOLATE-XZ_ITEM = §eInterpolation §7XZ-Achse
TRACE_SHOW_GUI_INTERPOLATE-XZ_LORE1 = §7Zeigt die Interpolation
TRACE_SHOW_GUI_INTERPOLATE-XZ_LORE2 = §7auf der XZ-Achse.
+TRACE_GUI_TITLE = Trace GUI
+TRACE_GUI_ITEM_BACK = §eBack
+TRACE_GUI_ITEM = §eTrace §8- §e{0} §7TNT
+TRACE_GUI_CLEAR = §eTraces löschen
+TRACE_GUI_RECORD_ITEM = §eTNT §8- §e{0} §7Positionen
+TRACE_GUI_RECORD_CLEAR = §eTNT löschen
+TRACE_GUI_POSITION_ITEM = §ePosition
+TRACE_GUI_POSITION_X = §7X§8: §e{0}
+TRACE_GUI_POSITION_Y = §7Y§8: §e{0}
+TRACE_GUI_POSITION_Z = §7Z§8: §e{0}
+TRACE_GUI_POSITION_EXPLODED = §7Explodiert§8: §e{0}
+
# Loader
LOADER_OFF = §caus
LOADER_SETUP = §eSetup
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/WorldEditUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/WorldEditUtils.java
new file mode 100644
index 00000000..2c152c76
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/WorldEditUtils.java
@@ -0,0 +1,54 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2021 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.features.slaves;
+
+import com.sk89q.worldedit.IncompleteRegionException;
+import com.sk89q.worldedit.WorldEdit;
+import com.sk89q.worldedit.bukkit.BukkitAdapter;
+import com.sk89q.worldedit.math.BlockVector3;
+import com.sk89q.worldedit.regions.RegionSelector;
+import de.steamwar.bausystem.shared.Pair;
+import lombok.experimental.UtilityClass;
+import org.bukkit.Location;
+import org.bukkit.World;
+import org.bukkit.entity.Player;
+
+@UtilityClass
+public class WorldEditUtils {
+
+ public Pair getSelection(Player player) {
+ RegionSelector regionSelector = WorldEdit.getInstance()
+ .getSessionManager()
+ .get(BukkitAdapter.adapt(player))
+ .getRegionSelector(BukkitAdapter.adapt(player.getWorld()));
+
+ try {
+ BlockVector3 min = regionSelector.getRegion().getMinimumPoint();
+ BlockVector3 max = regionSelector.getRegion().getMaximumPoint();
+ return new Pair<>(adapt(player.getWorld(), min), adapt(player.getWorld(), max));
+ } catch (IncompleteRegionException e) {
+ return null;
+ }
+ }
+
+ private Location adapt(World world, BlockVector3 blockVector3) {
+ return new Location(world, blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ());
+ }
+}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/Panzern.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/Panzern.java
similarity index 95%
rename from BauSystem_Main/src/de/steamwar/bausystem/features/panzern/Panzern.java
rename to BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/Panzern.java
index 57c93263..2bae3b14 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/Panzern.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/Panzern.java
@@ -17,7 +17,7 @@
* along with this program. If not, see .
*/
-package de.steamwar.bausystem.features.panzern;
+package de.steamwar.bausystem.features.slaves.panzern;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -38,7 +38,7 @@ public class Panzern {
private static final BlockFace[] BLOCK_FACES = new BlockFace[]{BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST, BlockFace.UP, BlockFace.DOWN};
- private Set current = new HashSet<>(); // Potenzielle geschwindigkeit durch `LinkedHashSet<>();` möchte aber lieber ein HashSet nehmen, weil dieses besser für mein Anwendungsfall ist
+ private Set current = new LinkedHashSet<>(); // Potenzielle geschwindigkeit durch `LinkedHashSet<>();` möchte aber lieber ein HashSet nehmen, weil dieses besser für mein Anwendungsfall ist
private Set emptyBlocks = new HashSet<>();
private World world;
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/PanzernAlgorithm.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernAlgorithm.java
similarity index 96%
rename from BauSystem_Main/src/de/steamwar/bausystem/features/panzern/PanzernAlgorithm.java
rename to BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernAlgorithm.java
index 56efcb8c..f77be675 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/PanzernAlgorithm.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernAlgorithm.java
@@ -17,7 +17,7 @@
* along with this program. If not, see .
*/
-package de.steamwar.bausystem.features.panzern;
+package de.steamwar.bausystem.features.slaves.panzern;
import org.bukkit.Material;
import org.bukkit.block.Block;
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/PanzernCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernCommand.java
similarity index 56%
rename from BauSystem_Main/src/de/steamwar/bausystem/features/panzern/PanzernCommand.java
rename to BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernCommand.java
index b5e74915..d0a37267 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/PanzernCommand.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernCommand.java
@@ -17,26 +17,33 @@
* along with this program. If not, see .
*/
-package de.steamwar.bausystem.features.panzern;
+package de.steamwar.bausystem.features.slaves.panzern;
-import com.sk89q.worldedit.IncompleteRegionException;
-import com.sk89q.worldedit.WorldEdit;
-import com.sk89q.worldedit.bukkit.BukkitAdapter;
-import com.sk89q.worldedit.math.BlockVector3;
-import com.sk89q.worldedit.regions.RegionSelector;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.SWUtils;
+import de.steamwar.bausystem.features.slaves.WorldEditUtils;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.shared.Pair;
import de.steamwar.command.SWCommand;
+import de.steamwar.command.TypeMapper;
import org.bukkit.Location;
import org.bukkit.Material;
-import org.bukkit.World;
+import org.bukkit.block.data.Bisected;
+import org.bukkit.block.data.Directional;
+import org.bukkit.block.data.MultipleFacing;
+import org.bukkit.block.data.type.Slab;
+import org.bukkit.block.data.type.Stairs;
+import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
@Linked(LinkageType.COMMAND)
public class PanzernCommand extends SWCommand {
@@ -52,7 +59,7 @@ public class PanzernCommand extends SWCommand {
return false;
}
- @Register
+ @Register(help = true)
public void genericHelp(Player player, String... args) {
BauSystem.MESSAGE.send("COMMAND_HELP_HEAD", player, "panzern");
BauSystem.MESSAGE.send("PANZERN_HELP", player);
@@ -63,11 +70,11 @@ public class PanzernCommand extends SWCommand {
}
@Register
- public void panzerSelection(Player player, Material blockMaterial, Material slabMaterial) {
+ public void panzerSelection(Player player, @Mapper("block") Material blockMaterial, @Mapper("slab") Material slabMaterial) {
if (!permissionCheck(player, Permission.WORLDEDIT)) {
return;
}
- Pair selection = getSelection(player);
+ Pair selection = WorldEditUtils.getSelection(player);
if (selection == null) {
BauSystem.MESSAGE.send("PANZERN_NO_WORLDEDIT", player);
return;
@@ -98,22 +105,55 @@ public class PanzernCommand extends SWCommand {
}.runTaskTimer(BauSystem.getInstance(), 1, 1);
}
- private Pair getSelection(Player player) {
- RegionSelector regionSelector = WorldEdit.getInstance()
- .getSessionManager()
- .get(BukkitAdapter.adapt(player))
- .getRegionSelector(BukkitAdapter.adapt(player.getWorld()));
-
- try {
- BlockVector3 min = regionSelector.getRegion().getMinimumPoint();
- BlockVector3 max = regionSelector.getRegion().getMaximumPoint();
- return new Pair<>(adapt(player.getWorld(), min), adapt(player.getWorld(), max));
- } catch (IncompleteRegionException e) {
- return null;
+ @Mapper(value = "block", local = true)
+ private TypeMapper blockMapper() {
+ Set strings = new HashSet<>();
+ for (Material material : Material.values()) {
+ if (!material.isBlock()) {
+ continue;
+ }
+ strings.add(material.name().toLowerCase());
}
+ return new TypeMapper() {
+ @Override
+ public List tabCompletes(CommandSender commandSender, String[] ignored, String s) {
+ return new ArrayList<>(strings);
+ }
+
+ @Override
+ public Material map(CommandSender commandSender, String[] previousArguments, String s) {
+ if (strings.contains(s.toLowerCase())) {
+ return Material.valueOf(s.toUpperCase());
+ }
+ return null;
+ }
+ };
}
- private Location adapt(World world, BlockVector3 blockVector3) {
- return new Location(world, blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ());
+ @Mapper(value = "slab", local = true)
+ private TypeMapper slabMapper() {
+ Set strings = new HashSet<>();
+ for (Material material : Material.values()) {
+ if (!material.isBlock()) {
+ continue;
+ }
+ if (material.name().contains("STAIRS") || material.name().contains("SLAB")) {
+ strings.add(material.name().toLowerCase());
+ }
+ }
+ return new TypeMapper() {
+ @Override
+ public List tabCompletes(CommandSender commandSender, String[] ignored, String s) {
+ return new ArrayList<>(strings);
+ }
+
+ @Override
+ public Material map(CommandSender commandSender, String[] previousArguments, String s) {
+ if (strings.contains(s.toLowerCase())) {
+ return Material.valueOf(s.toUpperCase());
+ }
+ return null;
+ }
+ };
}
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/PanzernResult.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernResult.java
similarity index 94%
rename from BauSystem_Main/src/de/steamwar/bausystem/features/panzern/PanzernResult.java
rename to BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernResult.java
index 7653d7a7..74f7a24c 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/PanzernResult.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernResult.java
@@ -17,7 +17,7 @@
* along with this program. If not, see .
*/
-package de.steamwar.bausystem.features.panzern;
+package de.steamwar.bausystem.features.slaves.panzern;
public enum PanzernResult {
EMPTY,
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/AdjacentHoney.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentHoney.java
similarity index 87%
rename from BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/AdjacentHoney.java
rename to BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentHoney.java
index d8fcd16e..4703515a 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/AdjacentHoney.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentHoney.java
@@ -17,10 +17,10 @@
* along with this program. If not, see .
*/
-package de.steamwar.bausystem.features.panzern.algorithms;
+package de.steamwar.bausystem.features.slaves.panzern.algorithms;
-import de.steamwar.bausystem.features.panzern.PanzernAlgorithm;
-import de.steamwar.bausystem.features.panzern.PanzernResult;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernResult;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import org.bukkit.Material;
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/AdjacentSlime.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentSlime.java
similarity index 87%
rename from BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/AdjacentSlime.java
rename to BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentSlime.java
index 757ed743..11523e5b 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/AdjacentSlime.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentSlime.java
@@ -17,10 +17,10 @@
* along with this program. If not, see .
*/
-package de.steamwar.bausystem.features.panzern.algorithms;
+package de.steamwar.bausystem.features.slaves.panzern.algorithms;
-import de.steamwar.bausystem.features.panzern.PanzernAlgorithm;
-import de.steamwar.bausystem.features.panzern.PanzernResult;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernResult;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import org.bukkit.Material;
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/CarpetWalkWay.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/CarpetWalkWay.java
similarity index 87%
rename from BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/CarpetWalkWay.java
rename to BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/CarpetWalkWay.java
index a710ec1d..302e951e 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/CarpetWalkWay.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/CarpetWalkWay.java
@@ -17,10 +17,10 @@
* along with this program. If not, see .
*/
-package de.steamwar.bausystem.features.panzern.algorithms;
+package de.steamwar.bausystem.features.slaves.panzern.algorithms;
-import de.steamwar.bausystem.features.panzern.PanzernAlgorithm;
-import de.steamwar.bausystem.features.panzern.PanzernResult;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernResult;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import org.bukkit.Material;
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/LadderWalkWay.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/LadderWalkWay.java
similarity index 88%
rename from BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/LadderWalkWay.java
rename to BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/LadderWalkWay.java
index fc608715..37ca6002 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/LadderWalkWay.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/LadderWalkWay.java
@@ -17,10 +17,10 @@
* along with this program. If not, see .
*/
-package de.steamwar.bausystem.features.panzern.algorithms;
+package de.steamwar.bausystem.features.slaves.panzern.algorithms;
-import de.steamwar.bausystem.features.panzern.PanzernAlgorithm;
-import de.steamwar.bausystem.features.panzern.PanzernResult;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernResult;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import org.bukkit.Material;
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/PistonLine.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PistonLine.java
similarity index 90%
rename from BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/PistonLine.java
rename to BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PistonLine.java
index bea0301d..9a0193b7 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/PistonLine.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PistonLine.java
@@ -17,10 +17,10 @@
* along with this program. If not, see .
*/
-package de.steamwar.bausystem.features.panzern.algorithms;
+package de.steamwar.bausystem.features.slaves.panzern.algorithms;
-import de.steamwar.bausystem.features.panzern.PanzernAlgorithm;
-import de.steamwar.bausystem.features.panzern.PanzernResult;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernResult;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import org.bukkit.Material;
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PowerableActivation.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PowerableActivation.java
new file mode 100644
index 00000000..0fc5d4d4
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PowerableActivation.java
@@ -0,0 +1,86 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2021 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.features.slaves.panzern.algorithms;
+
+import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernResult;
+import de.steamwar.bausystem.linkage.LinkageType;
+import de.steamwar.bausystem.linkage.Linked;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.block.data.AnaloguePowerable;
+import org.bukkit.block.data.Directional;
+import org.bukkit.block.data.Powerable;
+import org.bukkit.block.data.type.RedstoneWire;
+
+import java.util.Map;
+import java.util.Set;
+
+@Linked(LinkageType.PANZERN)
+public class PowerableActivation implements PanzernAlgorithm {
+
+ @Override
+ public PanzernResult check(Block source, Map adjacent, Set adjacentMaterials) {
+ int powered = 0;
+ int powerable = 0;
+ for (BlockFace blockFace : HORIZONTAL_FACES) {
+ if (!adjacent.containsKey(blockFace)) {
+ continue;
+ }
+ Block block = adjacent.get(blockFace);
+ if (block.getBlockData() instanceof Powerable || block.getBlockData() instanceof AnaloguePowerable && block.getType() != Material.OBSERVER) {
+ powerable++;
+ }
+ if (block.getType() == Material.TNT) {
+ powerable++;
+ }
+ switch (block.getType()) {
+ case REDSTONE_WIRE:
+ RedstoneWire redstoneWire = (RedstoneWire) block.getBlockData();
+ boolean dot = true;
+ for (BlockFace current : HORIZONTAL_FACES) {
+ dot &= redstoneWire.getFace(current) == RedstoneWire.Connection.NONE;
+ }
+ if (dot) {
+ powered++;
+ } else if (redstoneWire.getAllowedFaces().contains(blockFace)) {
+ if (redstoneWire.getFace(blockFace) == RedstoneWire.Connection.SIDE) {
+ powered++;
+ }
+ }
+ break;
+ case REPEATER:
+ case COMPARATOR:
+ case OBSERVER:
+ if (((Directional) block.getBlockData()).getFacing() == blockFace) {
+ powered++;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ if (powered <= 1 && powerable <= 1) {
+ return PanzernResult.DEFAULT;
+ }
+ return PanzernResult.SLAB;
+ }
+}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/SlabOnRedstone.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/SlabOnRedstone.java
similarity index 89%
rename from BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/SlabOnRedstone.java
rename to BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/SlabOnRedstone.java
index b974ef1d..74c2ddf3 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/SlabOnRedstone.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/SlabOnRedstone.java
@@ -17,10 +17,10 @@
* along with this program. If not, see .
*/
-package de.steamwar.bausystem.features.panzern.algorithms;
+package de.steamwar.bausystem.features.slaves.panzern.algorithms;
-import de.steamwar.bausystem.features.panzern.PanzernAlgorithm;
-import de.steamwar.bausystem.features.panzern.PanzernResult;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernResult;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import org.bukkit.Material;
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/SlabOnTorch.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/SlabOnTorch.java
similarity index 72%
rename from BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/SlabOnTorch.java
rename to BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/SlabOnTorch.java
index 1bd00131..c496b1af 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/SlabOnTorch.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/SlabOnTorch.java
@@ -17,15 +17,16 @@
* along with this program. If not, see .
*/
-package de.steamwar.bausystem.features.panzern.algorithms;
+package de.steamwar.bausystem.features.slaves.panzern.algorithms;
-import de.steamwar.bausystem.features.panzern.PanzernAlgorithm;
-import de.steamwar.bausystem.features.panzern.PanzernResult;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernResult;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
+import org.bukkit.block.data.Powerable;
import java.util.Map;
import java.util.Set;
@@ -37,7 +38,17 @@ public class SlabOnTorch implements PanzernAlgorithm {
public PanzernResult check(Block source, Map adjacent, Set adjacentMaterials) {
boolean hasRedstone = false;
for (BlockFace blockFace : HORIZONTAL_FACES) {
- if (adjacent.containsKey(blockFace) && adjacent.get(blockFace).getType() == Material.REDSTONE_WIRE) {
+ if (!adjacent.containsKey(blockFace)) {
+ continue;
+ }
+ Block block = adjacent.get(blockFace);
+ if (block.getType() == Material.OBSERVER) {
+ continue;
+ }
+ if (block.getBlockData() instanceof Powerable) {
+ hasRedstone = true;
+ }
+ if (block.getType() == Material.TNT) {
hasRedstone = true;
}
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/StairWalkWay.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/StairWalkWay.java
similarity index 91%
rename from BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/StairWalkWay.java
rename to BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/StairWalkWay.java
index 5cb62486..ee08a485 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/panzern/algorithms/StairWalkWay.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/StairWalkWay.java
@@ -17,10 +17,10 @@
* along with this program. If not, see .
*/
-package de.steamwar.bausystem.features.panzern.algorithms;
+package de.steamwar.bausystem.features.slaves.panzern.algorithms;
-import de.steamwar.bausystem.features.panzern.PanzernAlgorithm;
-import de.steamwar.bausystem.features.panzern.PanzernResult;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernResult;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import org.bukkit.Material;
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java
index f526babd..dc7fcb45 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java
@@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.tracer;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
+import de.steamwar.bausystem.features.tracer.gui.TraceGui;
import de.steamwar.bausystem.features.tracer.gui.TraceShowGui;
import de.steamwar.bausystem.features.tracer.record.RecordStateMachine;
import de.steamwar.bausystem.features.tracer.show.ShowModeParameter;
@@ -92,15 +93,21 @@ public class TraceCommand extends SWCommand {
BauSystem.MESSAGE.sendPrefixless("TRACE_COMMAND_HELP_START", p);
BauSystem.MESSAGE.sendPrefixless("TRACE_COMMAND_HELP_STOP", p);
BauSystem.MESSAGE.sendPrefixless("TRACE_COMMAND_HELP_AUTO", p);
- // p.sendMessage("§8/§etrace show gui §8- §7Zeigt die Trace show gui");
+ p.sendMessage("§8/§etrace show gui §8- §7Zeigt die Trace show gui");
BauSystem.MESSAGE.sendPrefixless("TRACE_COMMAND_HELP_SHOW", p);
BauSystem.MESSAGE.sendPrefixless("TRACE_COMMAND_HELP_HIDE", p);
BauSystem.MESSAGE.sendPrefixless("TRACE_COMMAND_HELP_DELETE", p);
// p.sendMessage("§8/§etrace list §8<§7FRAME-ID§8> §8- §7Listet alle TNT auf");
- // p.sendMessage("§8/§etrace gui §8- §7Zeigt die Trace Oberfläche an");
+ p.sendMessage("§8/§etrace gui §8- §7Zeigt die Trace Oberfläche an");
// p.sendMessage("§7Optionale Parameter mit §8<>§7, Benötigte Parameter mit §8[]");
}
+ @Register({"gui"})
+ public void guiCommand(Player p) {
+ if (!permissionCheck(p)) return;
+ TraceGui.openGui(p);
+ }
+
@Register({"start"})
public void startCommand(Player p) {
if (!permissionCheck(p)) return;
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/gui/TraceGui.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/gui/TraceGui.java
new file mode 100644
index 00000000..1b87bbf4
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/gui/TraceGui.java
@@ -0,0 +1,101 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2021 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.features.tracer.gui;
+
+import de.steamwar.bausystem.BauSystem;
+import de.steamwar.bausystem.features.tracer.TNTPosition;
+import de.steamwar.bausystem.features.tracer.show.Record;
+import de.steamwar.bausystem.features.tracer.show.StoredRecords;
+import de.steamwar.bausystem.features.tracer.show.TraceShowManager;
+import de.steamwar.inventory.SWItem;
+import de.steamwar.inventory.SWListInv;
+import lombok.experimental.UtilityClass;
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+@UtilityClass
+public class TraceGui {
+
+ public static void openGui(Player player) {
+ List> recordList = new ArrayList<>();
+ StoredRecords.getRecords().forEach(record -> {
+ if (record.getTnt().isEmpty()) {
+ return;
+ }
+ SWItem swItem = new SWItem(Material.TNT, BauSystem.MESSAGE.parse("TRACE_GUI_ITEM", player, record.size()));
+ recordList.add(new SWListInv.SWListEntry<>(swItem, record));
+ });
+ SWListInv recordSWListInv = new SWListInv<>(player, BauSystem.MESSAGE.parse("TRACE_GUI_TITLE", player), false, recordList, (clickType, record) -> {
+ openRecordGui(player, record);
+ });
+ recordSWListInv.setItem(48, new SWItem(Material.BUCKET, BauSystem.MESSAGE.parse("TRACE_GUI_CLEAR", player), clickType -> {
+ StoredRecords.clear();
+ player.getOpenInventory().close();
+ }));
+ recordSWListInv.setItem(50, new SWItem(Material.GLASS, "§e" + BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_TITLE", player), clickType -> {
+ TraceShowGui.openGui(player);
+ }));
+ recordSWListInv.open();
+ }
+
+ public static void openRecordGui(Player player, Record record) {
+ List> recordList = new ArrayList<>();
+ record.getTnt().forEach(tntRecord -> {
+ SWItem swItem = new SWItem(Material.TNT_MINECART, BauSystem.MESSAGE.parse("TRACE_GUI_RECORD_ITEM", player, tntRecord.getPositions().size()));
+ recordList.add(new SWListInv.SWListEntry<>(swItem, tntRecord));
+ });
+ SWListInv tntRecordSWListInv = new SWListInv<>(player, BauSystem.MESSAGE.parse("TRACE_GUI_TITLE", player), false, recordList, (clickType, tntRecord) -> {
+ openTntGui(player, record, tntRecord);
+ });
+ tntRecordSWListInv.setItem(48, new SWItem(Material.BUCKET, BauSystem.MESSAGE.parse("TRACE_GUI_RECORD_CLEAR", player), clickType -> {
+ StoredRecords.getRecords().remove(record);
+ TraceShowManager.reshow();
+ openGui(player);
+ }));
+ tntRecordSWListInv.setItem(49, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("TRACE_GUI_ITEM_BACK", player), clickType -> {
+ openGui(player);
+ }));
+ // 48, 51
+ tntRecordSWListInv.open();
+ }
+
+ public static void openTntGui(Player player, Record record, Record.TNTRecord tntRecord) {
+ List> positionList = new ArrayList<>();
+ tntRecord.getPositions().forEach(tntPosition -> {
+ SWItem swItem = new SWItem(Material.PAPER, BauSystem.MESSAGE.parse("TRACE_GUI_POSITION_ITEM", player));
+ swItem.setLore(Arrays.asList(
+ BauSystem.MESSAGE.parse("TRACE_GUI_POSITION_X", player, tntPosition.getLocation().getX()),
+ BauSystem.MESSAGE.parse("TRACE_GUI_POSITION_Y", player, tntPosition.getLocation().getY()),
+ BauSystem.MESSAGE.parse("TRACE_GUI_POSITION_Z", player, tntPosition.getLocation().getZ()),
+ BauSystem.MESSAGE.parse("TRACE_GUI_POSITION_EXPLODED", player, tntPosition.isExploded())));
+ positionList.add(new SWListInv.SWListEntry<>(swItem, tntPosition));
+ });
+ SWListInv tntPositionSWListInv = new SWListInv<>(player, BauSystem.MESSAGE.parse("TRACE_GUI_TITLE", player), false, positionList, (clickType, tntPosition) -> {
+ });
+ tntPositionSWListInv.setItem(49, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("TRACE_GUI_ITEM_BACK", player), clickType -> {
+ openRecordGui(player, record);
+ }));
+ tntPositionSWListInv.open();
+ }
+}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java
index 63f39cfa..ae580283 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/Record.java
@@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.tracer.show;
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
import de.steamwar.bausystem.features.tracer.TNTPosition;
import de.steamwar.bausystem.shared.ShowMode;
+import lombok.Getter;
import org.bukkit.entity.TNTPrimed;
import java.util.ArrayList;
@@ -30,6 +31,8 @@ import java.util.List;
public class Record {
private final long startTime;
+
+ @Getter
private final List tnt = new ArrayList<>();
public int size() {
@@ -62,6 +65,8 @@ public class Record {
}
public static class TNTRecord {
+
+ @Getter
private final List positions = new ArrayList<>(41);
public void showAll(ShowMode mode) {
@@ -88,9 +93,5 @@ public class Record {
public void explode(TNTPrimed tntPrimed) {
add(tntPrimed, true);
}
-
- public List getPositions() {
- return positions;
- }
}
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/StoredRecords.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/StoredRecords.java
index 09cd96d8..8fe8fb08 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/StoredRecords.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/StoredRecords.java
@@ -22,12 +22,14 @@ package de.steamwar.bausystem.features.tracer.show;
import de.steamwar.bausystem.features.tracer.TNTPosition;
import de.steamwar.bausystem.features.tracer.record.RecordStateMachine;
import de.steamwar.bausystem.shared.ShowMode;
+import lombok.Getter;
import java.util.ArrayList;
import java.util.List;
public class StoredRecords {
+ @Getter
private static final List records = new ArrayList<>();
public static void add(Record record) {
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/TraceShowManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/TraceShowManager.java
index fca38c75..3f93a0cb 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/TraceShowManager.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/TraceShowManager.java
@@ -31,6 +31,11 @@ public class TraceShowManager implements Listener {
traceShowMode.hide();
}
+ public static void reshow() {
+ Map> current = new HashMap<>(showModes);
+ current.forEach(TraceShowManager::show);
+ }
+
/* Only to be called by record */
static void show(TNTPosition tnt) {
for (ShowMode mode : showModes.values())
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageType.java b/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageType.java
index 5e349372..7d033602 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageType.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageType.java
@@ -23,8 +23,8 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.configplayer.ConfigConverter;
import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.bausystem.features.gui.BauGUI;
-import de.steamwar.bausystem.features.panzern.Panzern;
-import de.steamwar.bausystem.features.panzern.PanzernAlgorithm;
+import de.steamwar.bausystem.features.slaves.panzern.Panzern;
+import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
import de.steamwar.bausystem.features.script.ScriptExecutor;
import de.steamwar.bausystem.features.script.SpecialCommand;
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/shared/ShowMode.java b/BauSystem_Main/src/de/steamwar/bausystem/shared/ShowMode.java
index edc10243..a37daa40 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/shared/ShowMode.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/shared/ShowMode.java
@@ -19,8 +19,6 @@
package de.steamwar.bausystem.shared;
-import de.steamwar.bausystem.shared.Position;
-
public interface ShowMode {
void show(T position);