SteamWar/FightSystem
Archiviert
13
1

Improved Countdown start and scoreboard #268

Manuell gemergt
Lixfel hat 2 Commits von qualityOfLife nach master 2021-04-29 19:59:15 +02:00 zusammengeführt
2 geänderte Dateien mit 20 neuen und 19 gelöschten Zeilen
Nur Änderungen aus Commit 5c95036830 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

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

Datei anzeigen

@ -69,14 +69,6 @@ public class FightScoreboard implements Listener, ScoreboardCallback {
SWScoreboard.removeScoreboard(event.getPlayer()); 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(){ private void generalScoreboard(){
setTitle("§eKampf"); setTitle("§eKampf");
List<String> scoreList = new ArrayList<>(); 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() { private void updateScoreboard() {
scores.clear(); scores.clear();
switch((index++ / 10) % 3){ if ((index++ / 5) % 2 == 0) {
case 0:
generalScoreboard(); generalScoreboard();
break; } else {
case 1: setTitle(Fight.getBlueTeam().getColoredName() + " " + Fight.getRedTeam().getColoredName());
teamScoreboard(Fight.getBlueTeam()); teamScoreboard(Fight.getBlueTeam());
break;
case 2:
teamScoreboard(Fight.getRedTeam()); teamScoreboard(Fight.getRedTeam());
} }
} }