Add copy to Simulator
Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
e77d82839d
Commit
f3ac49fd12
@ -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_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_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_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_NO_PERMS = §cYou are not allowed to use the simulator here
|
||||||
|
|
||||||
SIMULATOR_GUI_ITEM_NAME = §eTNT Simulator
|
SIMULATOR_GUI_ITEM_NAME = §eTNT Simulator
|
||||||
|
@ -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_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_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_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_NO_PERMS = §cDu darfst hier nicht den Simulator nutzen
|
||||||
|
|
||||||
SIMULATOR_GUI_ITEM_NAME = §eTNT Simulator
|
SIMULATOR_GUI_ITEM_NAME = §eTNT Simulator
|
||||||
|
@ -97,6 +97,20 @@ public class SimulatorCommand extends SWCommand {
|
|||||||
tntSimulator.start(p);
|
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")
|
@Mapper("simulators")
|
||||||
public TypeMapper<String> allSimulators() {
|
public TypeMapper<String> allSimulators() {
|
||||||
return new TypeMapper<String>() {
|
return new TypeMapper<String>() {
|
||||||
|
@ -115,6 +115,10 @@ public class SimulatorStorage implements Enable, Disable {
|
|||||||
new File(simulatorsDir, name + ".simulator").delete();
|
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) {
|
public static void removeSimulator(ItemStack itemStack) {
|
||||||
if (!ItemUtils.isItem(itemStack, "simulator")) {
|
if (!ItemUtils.isItem(itemStack, "simulator")) {
|
||||||
return;
|
return;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren