From 37a1f728f50aca9a7dd3e7b377d98ccaf3f12fd0 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 15 Jan 2022 14:59:52 +0100 Subject: [PATCH] Fix HellsBells messages --- .../de/steamwar/fightsystem/FightSystem.properties | 10 ++++++++++ .../de/steamwar/fightsystem/event/HellsBells.java | 14 ++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties index ba892b1..7a1e4d3 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties +++ b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties @@ -203,6 +203,16 @@ BAR_WATER={0} §8Wasser # Winconditions HELLS_BELLS_COUNTDOWN=bis die Bomben fallen +HELLS_BELLS_START_1=§c!!Achtung!! Bomber im Anflug, noch ca. eine Minute bis zur Ankunft. +HELLS_BELLS_START_2=§cBomber im Anflug, ca. eine Minute bis zur Ankunft. +HELLS_BELLS_START_3=§cBomber auf dem Radar gesichtet, geschätzte Ankunftszeit: eine Minute. +HELLS_BELLS_START_4=§cUnbekanntes Flugobjekt gesichtet, trifft in ca. einer Minute ein. +HELLS_BELLS_START_5=§cFlugobjekt gesichtet. Ankunft in ca. einer Minute. +HELLS_BELLS_START_6=§cBomber erschienen, Ankunft ca. eine Minute. +HELLS_BELLS_SWAP_1=§aDie Bomben fallen nun schneller. +HELLS_BELLS_SWAP_2=§aMehr Bomber im Anflug. +HELLS_BELLS_SWAP_3=§aZusätzliche Bomber gesichtet. +HELLS_BELLS_SWAP_4=§aDas Bombardement scheint sich zu erhöhen. METEOR_COUNTDOWN=bis es Meteore regnet TECHKO_COUNTDOWN=bis {0} §7einen Schuss abgegeben haben muss diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java b/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java index fbce5a5..013e314 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java @@ -22,6 +22,7 @@ package de.steamwar.fightsystem.event; import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.countdown.Countdown; +import de.steamwar.fightsystem.record.GlobalRecorder; import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.StateDependent; import de.steamwar.fightsystem.utils.Message; @@ -33,6 +34,8 @@ import org.bukkit.World; import org.bukkit.entity.EntityType; import org.bukkit.scheduler.BukkitTask; +import java.util.Arrays; +import java.util.List; import java.util.Random; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Level; @@ -50,10 +53,21 @@ public class HellsBells { private HellsBellsCountdown currentCountdown; private BukkitTask currentDropping; + private final List startMessages = Arrays.asList("HELLS_BELLS_START_1", "HELLS_BELLS_START_2", + "HELLS_BELLS_START_3", "HELLS_BELLS_START_4", "HELLS_BELLS_START_5", "HELLS_BELLS_START_6"); + private final List stateSwapMessages = Arrays.asList("HELLS_BELLS_SWAP_1", "HELLS_BELLS_SWAP_2", + "HELLS_BELLS_SWAP_3", "HELLS_BELLS_SWAP_4"); + public void startCountdown() { if (current == State.PRE) { + String startMessage = startMessages.get(random.nextInt(startMessages.size())); + GlobalRecorder.getInstance().system(startMessage); + FightSystem.getMessage().broadcast(startMessage); current = current.getNext(); } else if (current != State.LAST && currentDrops >= current.SWITCH_AFTER) { + String stateSwapMessage = stateSwapMessages.get(random.nextInt(stateSwapMessages.size())); + GlobalRecorder.getInstance().system(stateSwapMessage); + FightSystem.getMessage().broadcast(stateSwapMessage); currentDrops = 0; }