While using Spigot (1.8.8 Snapshot), I've created a scoreboard and it seems to act weird after a while (Flashes more and more till it just simply doesn't look like a scoreboard anymore and crashes). This is what I mean;
After this, my server just simply crashed and it returned an IOException
This is my code;
package com.pr0totype2.razerrealm.holograms; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.Listener; import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Score; import org.bukkit.scoreboard.Scoreboard; import com.pr0totype2.razerrealm.RazerRealm; public class ScoreboardManagement implements Listener { private RazerRealm plugin; Scoreboard mainBoard; Objective objective; Score score; String splitLine = ChatColor.RED + "" + ChatColor.BOLD + ChatColor.STRIKETHROUGH + "-------------"; public ScoreboardManagement(RazerRealm plugin) { this.plugin = plugin; } public Scoreboard mainScoreboard(Player player) { mainBoard = Bukkit.getScoreboardManager().getNewScoreboard(); objective = mainBoard.registerNewObjective("rekt", "dummy"); objective.setDisplayName(ChatColor.DARK_GREEN + "R" + ChatColor.GREEN + "azer" + ChatColor.DARK_GREEN + "R" + ChatColor.GREEN + "ealm"); objective.setDisplaySlot(DisplaySlot.SIDEBAR); score = objective.getScore(splitLine + ChatColor.RED); score.setScore(99); score = objective.getScore(plugin.rankshandler.getPrefix(player) + " " + player.getDisplayName()); score.setScore(98); score = objective.getScore(splitLine + ChatColor.BLUE); score.setScore(97); score = objective.getScore(ChatColor.YELLOW + " " + ChatColor.BOLD + "WEB"); score.setScore(96); score = objective.getScore(ChatColor.AQUA + "websitedotcom"); score.setScore(95); score = objective.getScore(ChatColor.YELLOW + "" + ChatColor.BOLD + "TAG: " + ChatColor.DARK_GRAY + "[" + ChatColor.GRAY + plugin.townhandler.getTownTag(player) + ChatColor.DARK_GRAY + "]"); score.setScore(94); score = objective.getScore(splitLine + ChatColor.AQUA); score.setScore(93); Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() { @Override public void run() { for (Player aOnline : Bukkit.getOnlinePlayers()) { aOnline.setScoreboard(mainScoreboard(aOnline)); } } }, 600L, 600L); return mainBoard; } }
This method is being triggered upon PlayerJoinEvent, PlayerQuitEvent and ofc via this runnable to update the scoreboard every x ticks.
Nobody's able to currently join my server as it'll simply crash after a few minutes after the first player joined the server.
What do I do? What's wrong?
Thanks in advance,
Pr0totype2