Hey guys my scoreboard keeps flashing. I feel like it might by the kind of task I'm using? I'm not entirely sure. What should I check on? Code: @Override public void onEnable() { PluginManager a = Bukkit.getPluginManager(); a.registerEvents(new PlayerJoin(), this); a.registerEvents(new PlayerQuit(), this); a.registerEvents(new ServerMOTD(), this); Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { public void run() { sendScoreboard(); sendTablist(); } }, 0, 20); }
@maux 1. I'm not sure if that is the issue, but you should use BukkitRunnables instead of BukkitScheduler. Read this post.
@X1machinemaker1X Should not be. @maux Your sendScoreboard method is probably making a new scoreboard every time it runs. Re-use the old one instead.
@timtower by reusing the old scoreboard, you mean just having the score change not the entire board? EDIT: NaturalPvP.onEnable() function (Move your mouse to reveal the content) NaturalPvP.onEnable() function (open) NaturalPvP.onEnable() function (close) Code: @Override public void onEnable() { PluginManager a = Bukkit.getPluginManager(); a.registerEvents(new PlayerJoin(), this); a.registerEvents(new PlayerQuit(), this); a.registerEvents(new ServerMOTD(), this); Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { public void run() { sendScoreboard(); sendTablist(); } }, 0, 20); } NaturalPvP.sendScoreboard() function (Move your mouse to reveal the content) NaturalPvP.sendScoreboard() function (open) NaturalPvP.sendScoreboard() function (close) Code: public static void sendScoreboard() { for (Player player : Bukkit.getOnlinePlayers()) { NaturalScoreboard scoreboard = new NaturalScoreboard(); MauxScoreboard board = new MauxScoreboard("§a§l" + NaturalPvP.getServerName()); scoreboard.sendScoreboard(player, board); board.build(); board.send(player); } } NaturalScoreboard.sendScoreboard() function (Move your mouse to reveal the content) NaturalScoreboard.sendScoreboard() function (open) NaturalScoreboard.sendScoreboard() function (close) Code: public void sendScoreboard(Player player, MauxScoreboard scoreboard) { Essentials ess = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials"); User b = ess.getUser(player); FPlayer c = FPlayers.getInstance().getByPlayer(player); scoreboard.add("§8§l§m================"); scoreboard.add("§f§lPlayer"); scoreboard.add("§7Name: §a" + player.getName()); scoreboard.add("§7Balance: §a" + b.getMoney()); scoreboard.blankLine(); scoreboard.add("§f§lFaction"); if (!c.hasFaction()) { scoreboard.add("§7Faction: §cWilderness"); scoreboard.add("§7Power: §c" + c.getFaction().getPowerRounded() + "§8/§c" + c.getFaction().getPowerMax()); } else { scoreboard.add("§7Faction: §e" + c.getFaction().getTag()); scoreboard.add("§7Power: §b" + c.getFaction().getPowerRounded() + "§8/§b" + c.getFaction().getPowerMax()); } scoreboard.blankLine(); scoreboard.add("§f§lServer"); scoreboard.add("§7Online: §a" + Bukkit.getOnlinePlayers().size()); scoreboard.add("§8§l§m================"); scoreboard.add("§9§l" + NaturalPvP.getServerAddress()); }
@timtower I changed the function, and nothing showed up! Code: public void sendScoreboard(Player player, MauxScoreboard scoreboard) { Essentials ess = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials"); User b = ess.getUser(player); FPlayer c = FPlayers.getInstance().getByPlayer(player); scoreboard.add("§8§l§m================"); scoreboard.add("§f§lPlayer"); scoreboard.add("§7Name: §a" + player.getName()); Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(NaturalPvP.getNaturalPvP(), new Runnable() { public void run() { scoreboard.add("§7Balance: §a" + b.getMoney()); scoreboard.blankLine(); scoreboard.add("§f§lFaction"); if (!c.hasFaction()) { scoreboard.add("§7Faction: §cWilderness"); scoreboard.add("§7Power: §c" + c.getFaction().getPowerRounded() + "§8/§c" + c.getFaction().getPowerMax()); } else { scoreboard.add("§7Faction: §e" + c.getFaction().getTag()); scoreboard.add("§7Power: §b" + c.getFaction().getPowerRounded() + "§8/§b" + c.getFaction().getPowerMax()); } scoreboard.blankLine(); scoreboard.add("§f§lServer"); scoreboard.add("§7Online: §a" + Bukkit.getOnlinePlayers().size()); } }, 0, 20); scoreboard.add("§8§l§m================"); scoreboard.add("§9§l" + NaturalPvP.getServerAddress()); }
@timtower the only thing that gets updated is the scores having to do with faction, balance, and amount of player. It gets sent to the player on the onEnable() function
@maux do any other plugins use a scoreboard? That might be what's causing it to blink. Another thing that may be why it's not showing up is that your only allowing the name and player name display. Try setting the score of the text you want.