Edit sync-async scoreboard

This commit is contained in:
Fabrizio La Rosa 2020-07-12 19:42:56 +02:00
parent 80cc409899
commit 4452fa33fc

View File

@ -37,7 +37,7 @@ public class ScoreboardManager {
this.plugin = plugin; this.plugin = plugin;
this.playerDataManager = plugin.getPlayerDataManager(); this.playerDataManager = plugin.getPlayerDataManager();
Bukkit.getScheduler().runTask(plugin, () -> reloadScoreboards(true)); Bukkit.getScheduler().runTask(plugin, () -> reloadScoreboards(true));
Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, this::updateScoreboards, 20L, 40L); Bukkit.getScheduler().runTaskTimer(plugin, this::updateScoreboards, 20L, 40L);
} }
private synchronized void updateScoreboards() { private synchronized void updateScoreboards() {
@ -45,6 +45,7 @@ public class ScoreboardManager {
final Set<Objective> objectives = primary.getObjectives(); final Set<Objective> objectives = primary.getObjectives();
final Set<Team> teams = primary.getTeams(); final Set<Team> teams = primary.getTeams();
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
/* /*
* Unregister all teams or objectives that are no longer present in the main * Unregister all teams or objectives that are no longer present in the main
* scoreboard. * scoreboard.
@ -143,6 +144,7 @@ public class ScoreboardManager {
} }
} }
} }
});
} }
public synchronized void reloadScoreboards(boolean createNew) { public synchronized void reloadScoreboards(boolean createNew) {