SteamWar/FightSystem
Archiviert
13
1

Improved Countdown start and scoreboard

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2021-04-24 17:35:17 +02:00
Ursprung d81259fac9
Commit 5c95036830
2 geänderte Dateien mit 20 neuen und 19 gelöschten Zeilen

Datei anzeigen

@ -77,6 +77,7 @@ public abstract class Countdown {
time = totalTime;
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::count, 20, 20);
currentCountdowns.add(this);
show();
}
public void disable() {
@ -97,9 +98,10 @@ public abstract class Countdown {
smallestTime = countdown.time;
}
smallestTime -= 2;
smallestTime--;
for(Countdown countdown : currentCountdowns){
countdown.time -= smallestTime;
countdown.show();
}
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aBeide Teams waren damit einverstanden, zum nächsten Event zu beschleunigen!");
@ -118,7 +120,10 @@ public abstract class Countdown {
void count() {
time--;
show();
}
private void show(){
switch (time) {
case 900: case 600: case 300: case 180: case 120:
broadcast("§rNoch §a" + time / 60 + " §rMinuten " + countdownCounting());

Datei anzeigen

@ -69,14 +69,6 @@ public class FightScoreboard implements Listener, ScoreboardCallback {
SWScoreboard.removeScoreboard(event.getPlayer());
}
private void teamScoreboard(FightTeam fightTeam){
setTitle(fightTeam.getColoredName());
fightTeam.getPlayers().forEach(fp -> {
if(fp.isLiving())
addScore(fightTeam.getPrefix() + fp.getPlayer().getName(), (int) Math.ceil(fp.getPlayer().getHealth()));
});
}
private void generalScoreboard(){
setTitle("§eKampf");
List<String> scoreList = new ArrayList<>();
@ -105,16 +97,20 @@ public class FightScoreboard implements Listener, ScoreboardCallback {
}
}
private void teamScoreboard(FightTeam fightTeam){
fightTeam.getPlayers().forEach(fp -> {
if(fp.isLiving())
addScore(fightTeam.getPrefix() + fp.getPlayer().getName(), (int) Math.ceil(fp.getPlayer().getHealth()));
});
}
private void updateScoreboard() {
scores.clear();
switch((index++ / 10) % 3){
case 0:
if ((index++ / 5) % 2 == 0) {
generalScoreboard();
break;
case 1:
} else {
setTitle(Fight.getBlueTeam().getColoredName() + " " + Fight.getRedTeam().getColoredName());
teamScoreboard(Fight.getBlueTeam());
break;
case 2:
teamScoreboard(Fight.getRedTeam());
}
}