SteamWar/FightSystem
Archiviert
13
1

Merge pull request 'Improved Countdown start and scoreboard' (#268) from qualityOfLife into master

Reviewed-on: #268
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Lixfel 2021-04-29 19:59:14 +02:00
Commit ed5163d297
3 geänderte Dateien mit 21 neuen und 22 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!");
@ -116,9 +118,12 @@ public abstract class Countdown {
return time;
}
void count(){
private void count() {
time--;
show();
}
void show(){
switch (time) {
case 900: case 600: case 300: case 180: case 120:
broadcast("§rNoch §a" + time / 60 + " §rMinuten " + countdownCounting());

Datei anzeigen

@ -52,9 +52,7 @@ public class EnternCountdown extends Countdown {
}
@Override
void count(){
time--;
void show(){
Player player = fightPlayer.getPlayer();
switch (time) {
case 900: case 600: case 300: case 180: case 120:

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,17 +97,21 @@ 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:
generalScoreboard();
break;
case 1:
teamScoreboard(Fight.getBlueTeam());
break;
case 2:
teamScoreboard(Fight.getRedTeam());
if ((index++ / 5) % 2 == 0) {
generalScoreboard();
} else {
setTitle(Fight.getBlueTeam().getColoredName() + " " + Fight.getRedTeam().getColoredName());
teamScoreboard(Fight.getBlueTeam());
teamScoreboard(Fight.getRedTeam());
}
}