1.16.5 Scoreboard only updates on reload or restart

Discussion in 'Bukkit Help' started by Tobge, Jan 18, 2021.

Thread Status:
Not open for further replies.
  1. Offline

    Tobge

    I want to update my scoreboard but it only updates on reload or restart. Iam useing the 1.16.5

    My Code:

    Code:
    package de.systemwartung.score.utils;
    
    import de.systemwartung.bits.apis.BitAPI;
    import de.systemwartung.gold.apis.GoldAPI;
    import org.bukkit.Bukkit;
    import org.bukkit.entity.Player;
    import org.bukkit.scoreboard.DisplaySlot;
    import org.bukkit.scoreboard.Objective;
    import org.bukkit.scoreboard.Scoreboard;
    import org.bukkit.scoreboard.Team;
    
    public class ScoreboardManager {
    
        private static GoldAPI gold = new GoldAPI();
        private static BitAPI bits = new BitAPI();
    
          public static void setScoreboard(final Player player) {
    
              Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
    
              Objective obj = board.registerNewObjective("side", "dummy");
              obj.setDisplaySlot(DisplaySlot.SIDEBAR);
              obj.setDisplayName("§7» §5§lRIVAL§7 «");
    
              Team coins = board.registerNewTeam("coins");
              long anzahl = gold.getGold(player);
              coins.setPrefix("§7➥ ");
              coins.setSuffix("§6" + anzahl);
              coins.addEntry("§a");
    
              Team bit = board.registerNewTeam("bits");
              long anzahl1 = bits.getBits(player);
              bit.setPrefix("§7➥ ");
              bit.setSuffix("§9" + anzahl1);
              bit.addEntry("§1");
    
              Team level = board.registerNewTeam("level");
              level.setPrefix("§7➥ §fLevel ");
              level.setSuffix("§b1 §a(0/0)");
              level.addEntry("§9");
    
              obj.getScore("§7§m                 ").setScore(12);
              obj.getScore("§f§l❖ §c%ZONE%").setScore(11);
              obj.getScore("        ").setScore(10);
              obj.getScore("§f§lLevel:").setScore(9);
              obj.getScore("§9").setScore(8);
              obj.getScore("§2").setScore(7);
              obj.getScore("§f§lGoldmünzen:").setScore(6);
              obj.getScore("§a").setScore(5);
              obj.getScore("§3").setScore(4);
              obj.getScore("§f§lBits:").setScore(3);
              obj.getScore("§1").setScore(2);
              obj.getScore("§7§m                §7§m ").setScore(1);
    
              player.setScoreboard(board);
      }
        public void updateScoreBoard(Player player) {
    
            Scoreboard board = player.getScoreboard();
    
            long anzahl = gold.getGold(player);
            long anzahl1 = bits.getBits(player);
    
            board.getTeam("coins").setSuffix("§6" + anzahl);
            board.getTeam("bits").setSuffix("§9" + anzahl1);
        }
    } 
    Please help me
     
  2. Online

    timtower Administrator Administrator Moderator

    @Tobge And where do you call updates?
     
Thread Status:
Not open for further replies.

Share This Page