SteamWar/BauSystem2.0
Archiviert
12
0

Add copy to Simulator
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-09-20 14:18:49 +02:00
Ursprung daa97b9a4e
Commit f039687325
5 geänderte Dateien mit 21 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -498,6 +498,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

Datei anzeigen

@ -499,6 +499,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

Datei anzeigen

@ -497,6 +497,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

Datei anzeigen

@ -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<String> allSimulators() {
return new TypeMapper<String>() {

Datei anzeigen

@ -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;