From 7514728a722f623deff5741e5939c1d08bcd9271 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 13 Jun 2022 22:45:36 +0200 Subject: [PATCH] Fix SimulatorCommand invalid names Signed-off-by: yoyosource --- BauSystem_Main/src/BauSystem.properties | 1 + BauSystem_Main/src/BauSystem_de.properties | 1 + .../bausystem/features/simulator/SimulatorCommand.java | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 448669eb..a578fb06 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -513,6 +513,7 @@ SIMULATOR_GUI_ITEM_NAME = §eTNT Simulator SIMULATOR_NO_SIM_IN_HAND = §cNo simulator item selected SIMULATOR_GUI_SELECT_SIM = Simulator selection SIMULATOR_NAME_ALREADY_EXISTS = §cSimulator already exists +SIMULATOR_NAME_INVALID = §cInvalid name SIMULATOR_NOT_EXISTS = §cSimulator does not exist SIMULATOR_CREATE = §aSimulator created SIMULATOR_EDIT_LOCATION = §7Edit position diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index c2e2373a..52de07f8 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -514,6 +514,7 @@ SIMULATOR_GUI_ITEM_NAME = §eTNT Simulator SIMULATOR_NO_SIM_IN_HAND = §cKein Simulator Item gewählt SIMULATOR_GUI_SELECT_SIM = Simulator wählen SIMULATOR_NAME_ALREADY_EXISTS = §cSimulator existiert bereits +SIMULATOR_NAME_INVALID = §cUngültiger Name SIMULATOR_NOT_EXISTS = §cSimulator existiert nicht SIMULATOR_CREATE = §aSimulator erstellt SIMULATOR_EDIT_LOCATION = §7Editiere Positionen 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 49dda986..481e8407 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java @@ -62,6 +62,10 @@ public class SimulatorCommand extends SWCommand { BauSystem.MESSAGE.send("SIMULATOR_NAME_ALREADY_EXISTS", p); return; } + if (!name.matches("[a-zA-Z_]+")) { + BauSystem.MESSAGE.send("SIMULATOR_NAME_INVALID", p); + return; + } SimulatorStorage.createNewSimulator(name); BauSystem.MESSAGE.send("SIMULATOR_CREATE", p); }