Countdown to Actionbar
Dieser Commit ist enthalten in:
Ursprung
27c77b857f
Commit
37f2de6f64
@ -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)
|
||||
|
@ -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);
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren