Balance under player names

Discussion in 'Spigot Plugin Development' started by Yoreni, May 22, 2017.

  1. Hi i want to show other players money balance under the player names so players can see other players balance but whith my code they can only see thier own plase tell me what iam doing wrong
    Code (Text):

        public void underName(PlayerJoinEvent event)
            Player player = event.getPlayer();

            Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable()
                public void run()
                    Collection<? extends Player> players = Bukkit.getServer().getOnlinePlayers();
                    for(Player play : players)
                    Scoreboard Money = Bukkit.getScoreboardManager().getNewScoreboard();
                    Objective objective = Money.registerNewObjective(format(eco.getBalance(play),"money"), "dummy");

            }, 0L, 1L);
  2. Well first, you're setting the objective to "play" which will return one of the players in the collection (change your eco#getBalance(play) to eco#getBalance(player).

    Second, I haven't worked with raw scoreboards, mainly with apis, but won't this override every time a player joins?