From 3be33adb0084b382ad04fdf9f85870183b69d35b Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 6 Aug 2022 14:30:08 +0200 Subject: [PATCH] Add LoaderCommand.singleLoader Signed-off-by: yoyosource --- BauSystem_Main/src/BauSystem.properties | 3 +++ BauSystem_Main/src/BauSystem_de.properties | 11 +++++++---- .../bausystem/features/loader/Loader.java | 15 ++++++++++++++- .../bausystem/features/loader/LoaderCommand.java | 10 ++++++++++ 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 063c799b..231335bc 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -770,6 +770,7 @@ TRACE_CHAT_POSITION_EXPLODED = §7Exploded§8: §e{0} LOADER_OFF = §coff LOADER_SETUP = §eSetup LOADER_RUNNING = §aRunning +LOADER_SINGLE_SIDEBAR = §aSingle LOADER_PAUSE = §7Pause LOADER_END = §8Finished @@ -795,6 +796,7 @@ LOADER_HELP_PAUSE=§8/§7loader pause §8- §7Pauses Loader LOADER_HELP_RESUME=§8/§7loader resume §8- §7Resumes Loader LOADER_HELP_STOP=§8/§eloader stop §8- §7Stops recording/playback LOADER_HELP_CLEAR=§8/§eloader clear §8- §7Clears recording +LOADER_HELP_SINGLE=§8/§eloader single §8- §7Starts a single shot LOADER_HELP_OTHER=§7The loader works with §eIngame§8-§eTicks §7(20 ticks per Second) LOADER_NO_LOADER=§cYou have no Laoder. Create one with /loader setup LOADER_BACK_SETUP=§7DYour Loader is in Setup again @@ -804,6 +806,7 @@ LOADER_ACTIVE=§7The Loader is now active. LOADER_STOP=§7The Loader has been stopped. LOADER_PAUSED=§7The Loader is now paused. LOADER_RESUME=§7The Loader is resuming. +LOADER_SINGLE=§7The Loader is shooting once. LOADER_SMALL_TIME=§cThe wait time is to small LOADER_NEW_TIME=§7The wait time is now: {0}, before {1} LOADER_NEW_LOAD_TIME=§7The action wait time is now: {0}, before {1} diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index fd12d7b7..515b9407 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -749,10 +749,11 @@ TRACE_CHAT_POSITION_EXPLODED = §7Explodiert§8: §e{0} # Loader LOADER_OFF = §caus -LOADER_SETUP = §eSetup -LOADER_RUNNING = §aRunning -LOADER_PAUSE = §7Pause -LOADER_END = §8Finished +LOADER_SETUP = §eEinrichtung +LOADER_RUNNING = §aLaufend +LOADER_SINGLE_SIDEBAR = §aEiner +LOADER_PAUSE = §7Pausiert +LOADER_END = §8Beendet LOADER_MESSAGE_CLEAR = §7Loader gecleart LOADER_MESSAGE_CLEAR_HELP = §cDu must im Setup-Modus sein um den Loader zu clearen @@ -776,6 +777,7 @@ LOADER_HELP_PAUSE=§8/§7loader pause §8- §7Pausiert das Abspielen LOADER_HELP_RESUME=§8/§7loader resume §8- §7Spielt den Loader weiter ab LOADER_HELP_STOP=§8/§eloader stop §8- §7Stoppt die Aufnahme bzw. das Abspielen LOADER_HELP_CLEAR=§8/§eloader clear §8- §7Cleart die Aufnahme +LOADER_HELP_SINGLE=§8/§eloader single §8- §7Spielt die Aufnahme einmal ab LOADER_HELP_OTHER=§7Der Loader arbeitet mit §eIngame§8-§eTicks §7(20 Ticks pro Sekunde) LOADER_NO_LOADER=§cDu hast noch keinen Loader. Erstelle dir einen mit /loader setup LOADER_BACK_SETUP=§7Dein Loader ist nun wieder im Setup @@ -785,6 +787,7 @@ LOADER_ACTIVE=§7Der Loader ist nun aktiviert. LOADER_STOP=§7Der Loader ist nun gestoppt. LOADER_PAUSED=§7Der Loader ist nun pausiert. LOADER_RESUME=§7Der Loader läuft nun weiter. +LOADER_SINGLE=§7Der Loader schießt einmal. LOADER_SMALL_TIME=§cDie Wartezeit ist zu klein LOADER_NEW_TIME=§7Die Schusswartezeit ist nun: {0}, zuvor {1} LOADER_NEW_LOAD_TIME=§7Die Setzwartezeit ist nun: {0}, zuvor {1} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/Loader.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/Loader.java index 06acdd01..8c12f2de 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/Loader.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/Loader.java @@ -82,6 +82,7 @@ public class Loader implements Listener { } public void start() { + if (stage != Stage.SETUP) return; iterator = actions.listIterator(); countdown = 0; current = null; @@ -122,11 +123,21 @@ public class Loader implements Listener { } } + public void single() { + if (stage != Stage.PAUSE && stage != Stage.SETUP) return; + if (iterator == null || !iterator.hasNext()) { + iterator = actions.listIterator(); + countdown = 0; + current = null; + } + stage = Stage.SINGLE; + } + public void run() { if (stage == Stage.SETUP && lastActivation >= 0) lastActivation++; - if (stage != Stage.RUNNING) { + if (stage != Stage.RUNNING && stage != Stage.SINGLE) { return; } @@ -138,6 +149,7 @@ public class Loader implements Listener { if (!iterator.hasNext()) { countdown = getTicksBetweenShots(); iterator = actions.listIterator(); + if (stage == Stage.SINGLE) stage = Stage.PAUSE; return; } @@ -211,6 +223,7 @@ public class Loader implements Listener { public enum Stage implements EnumDisplay { SETUP("LOADER_SETUP"), RUNNING("LOADER_RUNNING"), + SINGLE("LOADER_SINGLE_SIDEBAR"), PAUSE("LOADER_PAUSE"), END("LOADER_END"); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderCommand.java index 616385f4..30fa127d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderCommand.java @@ -145,6 +145,16 @@ public class LoaderCommand extends SWCommand { loader.clear(); } + @Register(value = "single", description = "LOADER_HELP_SINGLE") + public void singleLoader(@Guard Player p) { + Loader loader = Loader.getLoader(p); + if (loaderNullCheck(loader, p)) { + return; + } + loader.single(); + BauSystem.MESSAGE.send("LOADER_SINGLE", p); + } + @ClassGuard(value = Player.class, local = true) public GuardChecker loaderGuard() { return (commandSender, guardCheckType, strings, s) -> {