From 5c950368309abfedb2362875868124fa1f2b9ca9 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 24 Apr 2021 17:35:17 +0200 Subject: [PATCH 1/2] Improved Countdown start and scoreboard Signed-off-by: Lixfel --- .../fightsystem/countdown/Countdown.java | 9 ++++-- .../fightsystem/listener/FightScoreboard.java | 30 ++++++++----------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/countdown/Countdown.java b/FightSystem_Main/src/de/steamwar/fightsystem/countdown/Countdown.java index 6d224d1..4626f17 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/countdown/Countdown.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/countdown/Countdown.java @@ -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(){ + 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()); diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/listener/FightScoreboard.java b/FightSystem_Main/src/de/steamwar/fightsystem/listener/FightScoreboard.java index 7b98067..f0ceb64 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/listener/FightScoreboard.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/listener/FightScoreboard.java @@ -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 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()); } } From 8cc92c5ac437542dae8e0fcb7907e402b01134e9 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 24 Apr 2021 20:18:39 +0200 Subject: [PATCH 2/2] Fix enterskip Signed-off-by: Lixfel --- .../src/de/steamwar/fightsystem/countdown/Countdown.java | 4 ++-- .../de/steamwar/fightsystem/countdown/EnternCountdown.java | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/countdown/Countdown.java b/FightSystem_Main/src/de/steamwar/fightsystem/countdown/Countdown.java index 4626f17..35ef83b 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/countdown/Countdown.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/countdown/Countdown.java @@ -118,12 +118,12 @@ public abstract class Countdown { return time; } - void count() { + private void count() { time--; show(); } - private void show(){ + void show(){ switch (time) { case 900: case 600: case 300: case 180: case 120: broadcast("§rNoch §a" + time / 60 + " §rMinuten " + countdownCounting()); diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/countdown/EnternCountdown.java b/FightSystem_Main/src/de/steamwar/fightsystem/countdown/EnternCountdown.java index 925bf69..f08a8fe 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/countdown/EnternCountdown.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/countdown/EnternCountdown.java @@ -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: