diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java index 66435414..5bd1e06d 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java @@ -56,7 +56,7 @@ public class BauScoreboard implements Listener { public void handlePlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); - SWScoreboard.createScoreboard(player, new ScoreboardCallback() { + SWScoreboard.impl.createScoreboard(player, new ScoreboardCallback() { @Override public HashMap getData() { Region region = Region.getRegion(player.getLocation()); diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/FightScoreboard.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/FightScoreboard.java index 63ca402f..7de1f306 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/FightScoreboard.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/FightScoreboard.java @@ -60,17 +60,17 @@ public class FightScoreboard implements Listener, ScoreboardCallback { private FightScoreboard(){ new StateDependentListener(ArenaMode.Replay, FightState.All, this); - Bukkit.getOnlinePlayers().forEach(player -> SWScoreboard.createScoreboard(player, this)); + Bukkit.getOnlinePlayers().forEach(player -> SWScoreboard.impl.createScoreboard(player, this)); } @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { - SWScoreboard.createScoreboard(event.getPlayer(), this); + SWScoreboard.impl.createScoreboard(event.getPlayer(), this); } @EventHandler public void onPlayerQuit(PlayerQuitEvent event) { - SWScoreboard.removeScoreboard(event.getPlayer()); + SWScoreboard.impl.removeScoreboard(event.getPlayer()); } public void setTitle(String t) { diff --git a/MissileWars/src/de/steamwar/misslewars/FightScoreboard.java b/MissileWars/src/de/steamwar/misslewars/FightScoreboard.java index 8b16b403..ca217fe2 100644 --- a/MissileWars/src/de/steamwar/misslewars/FightScoreboard.java +++ b/MissileWars/src/de/steamwar/misslewars/FightScoreboard.java @@ -53,7 +53,7 @@ class FightScoreboard implements Listener { @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { - SWScoreboard.createScoreboard(event.getPlayer(), new ScoreboardCallback() { + SWScoreboard.impl.createScoreboard(event.getPlayer(), new ScoreboardCallback() { @Override public String getTitle() { return "§eMissileWars"; @@ -81,7 +81,7 @@ class FightScoreboard implements Listener { @EventHandler public void onPlayerQuit(PlayerQuitEvent event) { - SWScoreboard.removeScoreboard(event.getPlayer()); + SWScoreboard.impl.removeScoreboard(event.getPlayer()); } static Scoreboard getScoreboard() { diff --git a/SpigotCore/SpigotCore_21/src/de/steamwar/scoreboard/SWScoreboard21.java b/SpigotCore/SpigotCore_21/src/de/steamwar/scoreboard/SWScoreboard21.java index f3c5f727..019e3898 100644 --- a/SpigotCore/SpigotCore_21/src/de/steamwar/scoreboard/SWScoreboard21.java +++ b/SpigotCore/SpigotCore_21/src/de/steamwar/scoreboard/SWScoreboard21.java @@ -30,7 +30,7 @@ import org.bukkit.scoreboard.Scoreboard; import java.util.HashMap; import java.util.Map; -public class SWScoreboard21 implements SWScoreboard.ISWScoreboard { +public class SWScoreboard21 implements SWScoreboard { private static final HashMap playerBoards = new HashMap<>(); private static final String SIDEBAR = "sw-sidebar"; diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard8.java index 3af0fc93..d65cf989 100644 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard8.java +++ b/SpigotCore/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard8.java @@ -29,7 +29,7 @@ import org.bukkit.entity.Player; import java.util.HashMap; import java.util.Map; -public class SWScoreboard8 implements SWScoreboard.ISWScoreboard { +public class SWScoreboard8 implements SWScoreboard { private static final Reflection.FieldAccessor scoreboardName = Reflection.getField(FlatteningWrapper.scoreboardObjective, String.class, 0); private static final Reflection.FieldAccessor scoreboardAction = Reflection.getField(FlatteningWrapper.scoreboardObjective, int.class, Core.getVersion() > 15 ? 3 : 0); private static final Class scoreboardDisplayEnum = Reflection.getClass("{nms.world.scores.criteria}.IScoreboardCriteria$EnumScoreboardHealthDisplay"); diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java index 5fd8808e..1d5c2d79 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java @@ -23,21 +23,9 @@ import de.steamwar.core.Core; import de.steamwar.core.VersionDependent; import org.bukkit.entity.Player; -public class SWScoreboard { - private SWScoreboard() {} +public interface SWScoreboard { + public static final SWScoreboard impl = VersionDependent.getVersionImpl(Core.getInstance()); - private static final ISWScoreboard impl = VersionDependent.getVersionImpl(Core.getInstance()); - - public static boolean createScoreboard(Player player, ScoreboardCallback callback) { - return impl.createScoreboard(player, callback); - } - - public static void removeScoreboard(Player player) { - impl.removeScoreboard(player); - } - - public interface ISWScoreboard { - boolean createScoreboard(Player player, ScoreboardCallback callback); - void removeScoreboard(Player player); - } + boolean createScoreboard(Player player, ScoreboardCallback callback); + void removeScoreboard(Player player); } diff --git a/TNTLeague/src/de/steamwar/tntleague/events/IngameListener.kt b/TNTLeague/src/de/steamwar/tntleague/events/IngameListener.kt index bb9b0415..e688dcbc 100644 --- a/TNTLeague/src/de/steamwar/tntleague/events/IngameListener.kt +++ b/TNTLeague/src/de/steamwar/tntleague/events/IngameListener.kt @@ -43,7 +43,7 @@ object IngameListener: Listener { @EventHandler fun onJoin(e: PlayerJoinEvent) { - SWScoreboard.createScoreboard(e.player, TNTLeagueScoreboard(e.player)) + SWScoreboard.impl.createScoreboard(e.player, TNTLeagueScoreboard(e.player)) } @EventHandler diff --git a/TNTLeague/src/de/steamwar/tntleague/game/TNTLeagueGame.kt b/TNTLeague/src/de/steamwar/tntleague/game/TNTLeagueGame.kt index 59d4e65c..94191c4e 100644 --- a/TNTLeague/src/de/steamwar/tntleague/game/TNTLeagueGame.kt +++ b/TNTLeague/src/de/steamwar/tntleague/game/TNTLeagueGame.kt @@ -57,7 +57,7 @@ object TNTLeagueGame { state = GameState.RUNNING - plugin.server.onlinePlayers.forEach { SWScoreboard.createScoreboard(it, TNTLeagueScoreboard(it)) } + plugin.server.onlinePlayers.forEach { SWScoreboard.impl.createScoreboard(it, TNTLeagueScoreboard(it)) } blueTeam.start() redTeam.start() @@ -101,7 +101,7 @@ object TNTLeagueGame { plugin.server.onlinePlayers.forEach { it.gameMode = GameMode.SPECTATOR - SWScoreboard.removeScoreboard(it) + SWScoreboard.impl.removeScoreboard(it) it.playSound(Sound.sound(org.bukkit.Sound.ENTITY_ENDER_DRAGON_DEATH.key, Sound.Source.MASTER, 1f, 1f)) }