From 7034402ea6c7db1341af4b2037741addfcbf1207 Mon Sep 17 00:00:00 2001 From: jojo Date: Sat, 26 Sep 2020 21:11:34 +0200 Subject: [PATCH] Fix FightScoreboard --- src/de/steamwar/misslewars/FightScoreboard.java | 10 +++------- src/de/steamwar/misslewars/MWTeam.java | 5 +++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/de/steamwar/misslewars/FightScoreboard.java b/src/de/steamwar/misslewars/FightScoreboard.java index a9e5f93..89a6f8d 100644 --- a/src/de/steamwar/misslewars/FightScoreboard.java +++ b/src/de/steamwar/misslewars/FightScoreboard.java @@ -50,19 +50,15 @@ class FightScoreboard { objective.setDisplaySlot(DisplaySlot.SIDEBAR); objective.setDisplayName("§eSpieler"); - teamScoreboard(MissileWars.getBlueTeam()); - teamScoreboard(MissileWars.getRedTeam()); - + MissileWars.getBlueTeam().teamScoreboard(objective); + MissileWars.getRedTeam().teamScoreboard(objective); Bukkit.getOnlinePlayers().forEach(player -> player.setScoreboard(scoreboard)); - }, 0, 200); + }, 0, 50); } static Scoreboard getScoreboard() { return scoreboard; } - private static void teamScoreboard(MWTeam fightTeam){ - fightTeam.getPlayers().forEach(p -> objective.getScore(fightTeam.getPrefix() + p.getName()).setScore(1)); - } } diff --git a/src/de/steamwar/misslewars/MWTeam.java b/src/de/steamwar/misslewars/MWTeam.java index 8c0b5ff..72ba713 100644 --- a/src/de/steamwar/misslewars/MWTeam.java +++ b/src/de/steamwar/misslewars/MWTeam.java @@ -28,6 +28,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Team; import java.util.LinkedList; @@ -93,6 +94,10 @@ public class MWTeam { } } + public void teamScoreboard(Objective objective) { + players.forEach(p -> objective.getScore(getPrefix() + p.getName()).setScore(1)); + } + public int size() { return players.size(); } -- 2.39.5