diff --git a/src/main/java/com/songoda/skyblock/scoreboard/Holder.java b/src/main/java/com/songoda/skyblock/scoreboard/Holder.java index f49be93c..ed21cfe9 100644 --- a/src/main/java/com/songoda/skyblock/scoreboard/Holder.java +++ b/src/main/java/com/songoda/skyblock/scoreboard/Holder.java @@ -39,7 +39,7 @@ class Holder { this.player.setScoreboard(board.board); } else { - this.player.setScoreboard(plugin.getServer().getScoreboardManager().getNewScoreboard()); + this.player.setScoreboard(scoreboardManager.getEmptyScoreboard()); } } } diff --git a/src/main/java/com/songoda/skyblock/scoreboard/ScoreboardManager.java b/src/main/java/com/songoda/skyblock/scoreboard/ScoreboardManager.java index 068c5742..c97125ef 100644 --- a/src/main/java/com/songoda/skyblock/scoreboard/ScoreboardManager.java +++ b/src/main/java/com/songoda/skyblock/scoreboard/ScoreboardManager.java @@ -9,8 +9,10 @@ import com.songoda.skyblock.playerdata.PlayerData; import com.songoda.skyblock.playerdata.PlayerDataManager; import com.songoda.skyblock.visit.Visit; import io.netty.util.internal.ConcurrentSet; +import org.bukkit.Bukkit; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; +import org.bukkit.scoreboard.Scoreboard; import java.io.File; import java.util.ArrayList; @@ -19,6 +21,7 @@ import java.util.Set; public class ScoreboardManager extends Manager { + private final Scoreboard emptyScoreboard; private final List drivers; private final Set disabledPlayers; @@ -26,6 +29,7 @@ public class ScoreboardManager extends Manager { super(plugin); this.drivers = new ArrayList<>(); this.disabledPlayers = new ConcurrentSet<>(); + this.emptyScoreboard = Bukkit.getScoreboardManager().getNewScoreboard(); for(ScoreboardType type : ScoreboardType.values()) { newDriver(type); @@ -139,4 +143,8 @@ public class ScoreboardManager extends Manager { driver.cancel(); drivers.clear(); } + + public Scoreboard getEmptyScoreboard() { + return emptyScoreboard; + } }