0

So using my two methods here

 public static void run(final Plugin plugin, String oldText, final Scroller scroller, final      Scoreboard board, final Objective obj){
    final String text = scroller.next();

    board.resetScores(Bukkit.getOfflinePlayer(oldText));

    Bukkit.getScheduler().runTaskTimer(plugin, new Runnable(){
        public void run(){
            Score score = obj.getScore(Bukkit.getOfflinePlayer(text));
            score.setScore(4);
            resetScores(scroller.next(), board, plugin, scroller);
        }
    }, 20L, 20L);
}

public static void resetScores(final String args, final Scoreboard board, Plugin plugin, Scroller scroller){
    Bukkit.getScheduler().runTaskLater(plugin, new Runnable(){
        @Override
        public void run() {
            board.resetScores(Bukkit.getOfflinePlayer(args));
        }
    }, 20L);

    scroller.next();
}

I cannot reset the score for the Player. I want it so it creates a scrolling fashion on my scoreboard. I am calling it like so (In a different class)

scoreboardScroller.run(plugin, "One Moment...", rankScroller, scoreboard, objective);
John
  • 131
  • 2
  • 15
  • You want to reset the score for the Player or you do not want to reset the score for the player? I am confused as to what exactly you want to happen. You want to keep adding scores to the board so you can have duplicates? – CodeCamper Apr 12 '14 at 04:43
  • Im trying to reset the score so that the old message gets removed and the new one gets added and takes it place. – John Apr 12 '14 at 04:44

1 Answers1

0

If you want to set the value at the same row, you can loop scoreboard's offline players, and if the op score == your row reset it.

public void update(String line, int row) {
   if (!this.scoreboard.getPlayers().contains(Bukkit.getOfflinePlayer(name))) {
    for (OfflinePlayer op : this.scoreboard.getPlayers()) {
     if (this.objective.getScore(op).getScore() == row) {
      remove(op.getName());
       break;
     }
    }
    add(line, row);
  }
}

Full code

Mata
  • 1