Good day. Faced a problem, from the run () method the countAnimationDisplayName variable is not visible.

The code itself:

tasks.put(player.getName(), new BukkitRunnable() { int countAnimationDisplayName = 0; public void run() { WrapperPlayServerScoreboardObjective objective = new WrapperPlayServerScoreboardObjective(); objective.setDisplayName(board.animationDisplayName.get(countAnimationDisplayName)); //objective. countAnimationDisplayName += 1; } }.runTaskTimer(this, 1L, intervalUpdate * 20L).getTaskId()); 

Error from IDE: countAnimationDisplayName cannot be resolved or is not a field

  • and javac himself sees? - Nofate ♦
  • the variable must be visible, the error is clearly in something else, but without the source it is difficult to say. - Artem Konovalov

0