mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-29 04:18:07 +01:00
Merge pull request #1704 from MisterFrans/dev-asyncboosbar-optimisation
Prevents creation of unnecessary threads when bossbar is in async
This commit is contained in:
commit
79fbf40ac6
@ -36,6 +36,12 @@ public class BossBarManager {
|
||||
}
|
||||
|
||||
public void ShowJobProgression(final JobsPlayer player, final JobProgression jobProg, double expGain) {
|
||||
if (Version.getCurrent().isLower(Version.v1_9_R1) || !Jobs.getGCManager().BossBarsMessageByDefault)
|
||||
return;
|
||||
|
||||
if (!ToggleBarHandling.getBossBarToggle().getOrDefault(player.getUniqueId().toString(), true))
|
||||
return;
|
||||
|
||||
if (Jobs.getGCManager().isBossBarAsync()) {
|
||||
CMIScheduler.get().runTaskAsynchronously(() -> ShowJobProgressionInTask(player, jobProg, expGain));
|
||||
} else {
|
||||
@ -44,12 +50,6 @@ public class BossBarManager {
|
||||
}
|
||||
|
||||
private synchronized void ShowJobProgressionInTask(final JobsPlayer player, final JobProgression jobProg, double expGain) {
|
||||
if (Version.getCurrent().isLower(Version.v1_9_R1) || !Jobs.getGCManager().BossBarsMessageByDefault)
|
||||
return;
|
||||
|
||||
if (!ToggleBarHandling.getBossBarToggle().getOrDefault(player.getUniqueId().toString(), true))
|
||||
return;
|
||||
|
||||
BossBar bar = null;
|
||||
BossBarInfo oldOne = null;
|
||||
for (BossBarInfo one : player.getBossBarInfo()) {
|
||||
|
Loading…
Reference in New Issue
Block a user