Scoreboard refreshing

Discussion in 'Spigot Plugin Development' started by Roimeiqui7, Aug 11, 2018.

  1. Hello guys, I'm refreshing my scoreboard but it makes this strange thing:

    I don't know why is doing this because in my localhost works fine.

    EDIT: This is my scoreboard code:
    Code (Text):
    public static void setScoreboard(Player p) {
            FullPvP pl = FullPvP.getPlugin(FullPvP.class);
            Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(pl, new Runnable() {
                public void run() {
                    final Scoreboard board = Bukkit.getServer().getScoreboardManager().getNewScoreboard();
                    final Objective o = board.registerNewObjective("Scoreboard", "dummy");
                    o.setDisplayName(Placeholders.replaceValues(p, "&6&lZalexMC &7| &fFullPvP"));
                    final List<String> text = new ArrayList<String>();
                    text.add("&6Online» &f%online%");
                    text.add("&6Kills» &f%kills%");
                    text.add("&6Deaths» &f%deaths%");
                    if (Cooldown.isCooling(p.getName(), "Enderpearl")) {
                        text.add("&6EnderPearl» &f%time%");
                    if (ClanManager.isInClan(p)) {
                        text.add("&6Clan» &f" + ClanManager.getClan(p));
                    if (StaffCMD.a.contains(p)) {
                        text.add("&6StaffMode» &aEnabled");
                        text.add("   &eGamemode: &f" + p.getGameMode());
                        text.add("   &eStaffChat: &f"
                                + new me.roimeiqui.zfullpvp.commands.messages.iPlayer(p).isStaffChat());
                        text.add("   &eVanished: &f" + VanishCommand.isV.contains(p));

                    int size = text.size();
                    String f = "";
                    for (final String s : text) {
                        f = Placeholders.replaceValues(p, s);
                        int currentLine = size - 1;
                        if (currentLine <= 15 && currentLine-- > 0) {
                            f = String.valueOf(f) + Placeholders.colorcodes[currentLine--];
                        int deaths = getDeaths(p.getUniqueId());
                        int kills = getKills(p.getUniqueId());
                                f.replace("%deaths%", String.valueOf(deaths)).replace("%kills%", String.valueOf(kills))
                                        .replace("%online%", String.valueOf(Bukkit.getServer().getOnlinePlayers().size()))
                                                String.valueOf(Cooldown.getRemaining(p.getName(), "Enderpearl")))))
            }, 0L, 1L);
    Thanks for help
  2. It's probably because you're using Objectives instead of Teams. And it could also be the problem that you are refreshing the scoreboard EVERY tick. That could be too fast, so i suggest you to change it to 20 ticks
  3. I cannot change it to 20 ticks because of I have a enderpearl cooldown witch have decimals. If I change it to Teams it would be fine?
  4. Changing it to teams will help a lot
    • Agree Agree x 1

Share This Page