diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/countdown/Countdown.java b/FightSystem_Main/src/de/steamwar/fightsystem/countdown/Countdown.java index ee0261a..8251e46 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/countdown/Countdown.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/countdown/Countdown.java @@ -3,8 +3,12 @@ package de.steamwar.fightsystem.countdown; import de.steamwar.core.Core; import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.fight.Fight; +import de.steamwar.fightsystem.listener.BasicListener; +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; import org.bukkit.Sound; +import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitScheduler; import java.util.ArrayList; @@ -56,22 +60,28 @@ public abstract class Countdown { countdowns.get(i).cancelTimer(); } + private void broadcast(String message){ + BaseComponent[] msg = TextComponent.fromLegacyText(message); + for(Player p : Bukkit.getOnlinePlayers()) + BasicListener.toActionbar(p, msg); + } + private void count(){ switch (time) { case 900: case 600: case 300: case 180: case 120: - Bukkit.broadcastMessage(FightSystem.PREFIX + "§7Noch §a" + time / 60 + " §7Minuten " + countdownCounting()); + broadcast("§7Noch §a" + time / 60 + " §7Minuten " + countdownCounting()); break; case 60: case 30: case 20: case 15: case 10: case 5: case 4: case 3: case 2: if(this.sound != null) Fight.playSound(this.sound, 100.0F, 1.0F); - Bukkit.broadcastMessage(FightSystem.PREFIX + "§7Noch §a" + time + " §7Sekunden " + countdownCounting()); + broadcast("§7Noch §a" + time + " §7Sekunden " + countdownCounting()); break; case 1: if(this.sound != null) Fight.playSound(this.sound, 100.0F, 1.0F); - Bukkit.broadcastMessage(FightSystem.PREFIX + "§7Noch §aeine §7Sekunde " + countdownCounting()); + broadcast("§7Noch §aeine §7Sekunde " + countdownCounting()); break; case 0: if(this.sound != null) diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/listener/BasicListener.java b/FightSystem_Main/src/de/steamwar/fightsystem/listener/BasicListener.java index 67e6660..f88d678 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/listener/BasicListener.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/listener/BasicListener.java @@ -45,7 +45,7 @@ public abstract class BasicListener implements Listener { listeners.remove(this); } - void toActionbar(Player player, BaseComponent... components){ + public static void toActionbar(Player player, BaseComponent... components){ switch(Core.getVersion()){ case 8: BasicListener_8.toActionbar(player, components);