diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties
index 892091c3..27f1c19d 100644
--- a/BauSystem_Main/src/BauSystem.properties
+++ b/BauSystem_Main/src/BauSystem.properties
@@ -509,6 +509,16 @@ SCRIPT_GUI_CONSTANT_TPS_LORE = §etps§7 of the server
SCRIPT_GUI_CONSTANT_TPS_LIMIT_NAME = §7Constant §etps_limit
SCRIPT_GUI_CONSTANT_TPS_LIMIT_LORE = §etps_limit§7 of the server
+# Shield Printing
+SHIELD_PRINTING_NO_REGION = §cYou are not in a region.
+SHIELD_PRINTING_NOT_RUNNING = §cThe shield printing is not running.
+SHIELD_PRINTING_DISALLOWED = §cYou are not allowed to use shield printing here.
+
+SHIELD_PRINTING_START = §aThe shield printing has been started.
+SHIELD_PRINTING_COPY = §aThe shield has been copied.
+SHIELD_PRINTING_APPLY = §aThe shield has been applied.
+SHIELD_PRINTING_STOP = §aThe shield printing has been stopped.
+
# Unsign Book
UNSIGN_HELP=§8/§eunsign §8- §7Make a signed book writable again
diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties
index d08d7d41..a1461a99 100644
--- a/BauSystem_Main/src/BauSystem_de.properties
+++ b/BauSystem_Main/src/BauSystem_de.properties
@@ -502,6 +502,16 @@ SCRIPT_GUI_CONSTANT_TPS_LORE = §etps§7 vom Server
SCRIPT_GUI_CONSTANT_TPS_LIMIT_NAME = §7Constant §etps_limit
SCRIPT_GUI_CONSTANT_TPS_LIMIT_LORE = §etps_limit§7 vom Server
+# Shield Printing
+SHIELD_PRINTING_NO_REGION = §cDu bist in keiner Region.
+SHIELD_PRINTING_NOT_RUNNING = §cShield printing ist nicht aktiv.
+SHIELD_PRINTING_DISALLOWED = §cDu darfst Shield printing nicht benutzen.
+
+SHIELD_PRINTING_START = §aShield printing wurde gestartet.
+SHIELD_PRINTING_COPY = §aSchilde wurden kopiert.
+SHIELD_PRINTING_APPLY = §aSchilde wurden angewendet.
+SHIELD_PRINTING_STOP = §aShield printing wurde gestoppt.
+
# Unsign Book
UNSIGN_HELP=§8/§eunsign §8- §7Mache ein Buch beschreibbar
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrinting.java b/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrinting.java
new file mode 100644
index 00000000..9cf829b5
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrinting.java
@@ -0,0 +1,101 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2023 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.shieldprinting;
+
+import de.steamwar.bausystem.BauSystem;
+import de.steamwar.bausystem.region.Region;
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.block.data.BlockData;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.BlockPistonExtendEvent;
+import org.bukkit.event.block.BlockPistonRetractEvent;
+import org.bukkit.util.Vector;
+
+import java.util.*;
+
+public class ShieldPrinting implements Listener {
+
+ private static final World WORLD = Bukkit.getWorlds().get(0);
+
+ /**
+ * Vector of current position, Vector of origin
+ */
+ private Map shieldMap = new HashMap<>();
+ private Map shieldData = new HashMap<>();
+
+ private final Region region;
+
+ public ShieldPrinting(Region region) {
+ this.region = region;
+ Bukkit.getPluginManager().registerEvents(this, BauSystem.getInstance());
+ }
+
+ public void copy() {
+ for (Map.Entry entry : shieldMap.entrySet()) {
+ shieldData.put(entry.getValue(), entry.getKey().toLocation(WORLD).getBlock().getBlockData());
+ }
+ }
+
+ public void apply() {
+ for (Map.Entry entry : shieldData.entrySet()) {
+ entry.getKey().toLocation(WORLD).getBlock().setBlockData(entry.getValue());
+ }
+ }
+
+ public void disable() {
+ BlockPistonExtendEvent.getHandlerList().unregister(this);
+ BlockPistonRetractEvent.getHandlerList().unregister(this);
+ shieldMap.clear();
+ shieldData.clear();
+ }
+
+ @EventHandler
+ public void onBlockPistonExtend(BlockPistonExtendEvent event) {
+ update(event.getDirection(), event.getBlocks());
+ }
+
+ @EventHandler
+ public void onBlockPistonRetract(BlockPistonRetractEvent event) {
+ update(event.getDirection(), event.getBlocks());
+ }
+
+ private void update(BlockFace direction, List blockList) {
+ Set toRemove = new HashSet<>();
+ Map temp = new HashMap<>();
+ for (Block block : blockList) {
+ if (Region.getRegion(block.getLocation()) != region) continue;
+ Vector vector = block.getLocation().toVector();
+ Vector origin = vector.clone();
+ vector = vector.add(direction.getDirection());
+ if (shieldMap.containsKey(origin)) {
+ toRemove.add(origin);
+ temp.put(vector, shieldMap.get(origin));
+ } else {
+ temp.put(vector, origin);
+ }
+ }
+ shieldMap.keySet().removeAll(toRemove);
+ shieldMap.putAll(temp);
+ }
+}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrintingCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrintingCommand.java
new file mode 100644
index 00000000..a789c748
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrintingCommand.java
@@ -0,0 +1,110 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2023 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.shieldprinting;
+
+import de.steamwar.bausystem.BauSystem;
+import de.steamwar.bausystem.Permission;
+import de.steamwar.bausystem.region.Region;
+import de.steamwar.command.SWCommand;
+import de.steamwar.command.TypeValidator;
+import de.steamwar.linkage.Linked;
+import org.bukkit.entity.Player;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Linked
+public class ShieldPrintingCommand extends SWCommand {
+
+ public ShieldPrintingCommand() {
+ super("shieldprinting");
+ }
+
+ private Map shieldMap = new HashMap<>();
+
+ @Register
+ public void genericCommand(@Validator Player player, ShieldPrintingState shieldPrintingState) {
+ Region region = Region.getRegion(player.getLocation());
+ if (region.isGlobal()) {
+ // BauSystem.MESSAGE.send("SHIELD_PRINTING_NO_REGION", player);
+ return;
+ }
+ ShieldPrinting shieldPrinting;
+ switch (shieldPrintingState) {
+ case START:
+ shieldPrinting = shieldMap.put(region, new ShieldPrinting(region));
+ if (shieldPrinting != null) {
+ shieldPrinting.disable();
+ }
+ BauSystem.MESSAGE.send("SHIELD_PRINTING_START", player);
+ break;
+ case COPY:
+ shieldPrinting = shieldMap.get(region);
+ if (shieldPrinting == null) {
+ BauSystem.MESSAGE.send("SHIELD_PRINTING_NOT_RUNNING", player);
+ return;
+ }
+ shieldPrinting.copy();
+ BauSystem.MESSAGE.send("SHIELD_PRINTING_COPY", player);
+ break;
+ case APPLY:
+ shieldPrinting = shieldMap.get(region);
+ if (shieldPrinting == null) {
+ BauSystem.MESSAGE.send("SHIELD_PRINTING_NOT_RUNNING", player);
+ return;
+ }
+ shieldPrinting.apply();
+ BauSystem.MESSAGE.send("SHIELD_PRINTING_APPLY", player);
+ break;
+ }
+ }
+
+ @Register("stop")
+ public void stopCommand(@Validator Player player) {
+ Region region = Region.getRegion(player.getLocation());
+ if (region.isGlobal()) {
+ BauSystem.MESSAGE.send("SHIELD_PRINTING_NO_REGION", player);
+ return;
+ }
+ ShieldPrinting shieldPrinting = shieldMap.remove(region);
+ if (shieldPrinting == null) {
+ BauSystem.MESSAGE.send("SHIELD_PRINTING_NOT_RUNNING", player);
+ return;
+ }
+ shieldPrinting.disable();
+ BauSystem.MESSAGE.send("SHIELD_PRINTING_STOP", player);
+ }
+
+ @ClassValidator(value = Player.class, local = true)
+ public TypeValidator validator() {
+ return (commandSender, player, messageSender) -> {
+ if (!Permission.hasPermission(player, Permission.WORLD)) {
+ messageSender.send("SHIELD_PRINTING_DISALLOWED", player);
+ return false;
+ }
+ Region region = Region.getRegion(player.getLocation());
+ if (region.isGlobal()) {
+ messageSender.send("SHIELD_PRINTING_NO_REGION", player);
+ return false;
+ }
+ return true;
+ };
+ }
+}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrintingState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrintingState.java
new file mode 100644
index 00000000..0f782f67
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/ShieldPrintingState.java
@@ -0,0 +1,27 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2023 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.shieldprinting;
+
+public enum ShieldPrintingState {
+
+ START,
+ COPY,
+ APPLY
+}