diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index c02e1194..31f3136e 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -506,6 +506,7 @@ SIMULATOR_CREATE_HELP = §8/§esimulator create §8[§7name§8] §8-§7 Create a SIMULATOR_CHANGE_HELP = §8/§esimulator change §8-§7 Change your simulator wand selection SIMULATOR_DELETE_HELP = §8/§esimulator delete §8[§7name§8] §8-§7 Deletes the simulator SIMULATOR_START_HELP = §8/§esimulator start §8[§7name§8] §8-§7 Starts the simulator +SIMULATOR_COPY_HELP = §8/§esimulator copy §8[§7to-copy§8] §8[§7name§8] §8-§7 Copy the simulator SIMULATOR_NO_PERMS = §cYou are not allowed to use the simulator here SIMULATOR_GUI_ITEM_NAME = §eTNT Simulator diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index 77b8aaef..612ebd7c 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -507,6 +507,7 @@ SIMULATOR_CREATE_HELP = §8/§esimulator create §8[§7name§8] §8-§7 Erstelle SIMULATOR_CHANGE_HELP = §8/§esimulator change §8-§7 Wechsel zu einem anderen Simulator SIMULATOR_DELETE_HELP = §8/§esimulator delete §8[§7name§8] §8-§7 Löscht den Simulator SIMULATOR_START_HELP = §8/§esimulator start §8[§7name§8] §8-§7 Startet die Simulation +SIMULATOR_COPY_HELP = §8/§esimulator copy §8[§7to-copy§8] §8[§7name§8] §8-§7 Kopiert einen Simulator SIMULATOR_NO_PERMS = §cDu darfst hier nicht den Simulator nutzen SIMULATOR_GUI_ITEM_NAME = §eTNT Simulator diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java index e97f9046..db38aabe 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java @@ -97,6 +97,20 @@ public class SimulatorCommand extends SWCommand { tntSimulator.start(p); } + @Register(value = "copy", description = "SIMULATOR_COPY_HELP") + public void copy(@Validator Player p, @Mapper("simulators") String toCopy, String name) { + TNTSimulator tntSimulator = SimulatorStorage.getSimulator(toCopy); + if (tntSimulator == null) { + BauSystem.MESSAGE.send("SIMULATOR_NOT_EXISTS", p); + return; + } + if (SimulatorStorage.getSimulator(name) != null) { + BauSystem.MESSAGE.send("SIMULATOR_NAME_ALREADY_EXISTS", p); + return; + } + SimulatorStorage.copySimulator(tntSimulator, name); + } + @Mapper("simulators") public TypeMapper allSimulators() { return new TypeMapper() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java index a75196c1..074298d8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java @@ -115,6 +115,10 @@ public class SimulatorStorage implements Enable, Disable { new File(simulatorsDir, name + ".simulator").delete(); } + public static void copySimulator(TNTSimulator tntSimulator, String name) { + tntSimulators.put(name, new TNTSimulator(tntSimulator.toYAPION())); + } + public static void removeSimulator(ItemStack itemStack) { if (!ItemUtils.isItem(itemStack, "simulator")) { return;