9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-31 12:56:43 +00:00

fix again

This commit is contained in:
XiaoMoMi
2024-12-19 00:25:47 +08:00
parent f195311ac5
commit 062df51466
2 changed files with 9 additions and 7 deletions

View File

@@ -74,6 +74,7 @@ public class ActionBarSender {
public void show() {
this.isShown = true;
this.refreshTimer = config.refreshRate();
senderTask = BukkitCustomFishingPlugin.getInstance().getScheduler().asyncRepeating(() -> {
switchTimer++;
boolean forceUpdate = false;
@@ -82,14 +83,14 @@ public class ActionBarSender {
counter++;
forceUpdate = true;
}
if (refreshTimer < config.refreshRate() && !forceUpdate){
refreshTimer++;
} else {
if (forceUpdate || refreshTimer >= config.refreshRate()) {
refreshTimer = 0;
DynamicText text = texts[counter % (texts.length)];
updatePrivatePlaceholders();
text.update(this.privateContext.placeholderMap());
audience.sendActionBar(AdventureHelper.miniMessage(text.getLatestValue()));
} else {
refreshTimer++;
}
}, 50, 50, TimeUnit.MILLISECONDS);
}

View File

@@ -85,6 +85,7 @@ public class BossBarSender {
public void show() {
this.isShown = true;
this.bossBar.addViewer(audience);
this.refreshTimer = config.refreshRate();
this.senderTask = BukkitCustomFishingPlugin.getInstance().getScheduler().asyncRepeating(() -> {
switchTimer++;
boolean forceUpdate = false;
@@ -93,16 +94,16 @@ public class BossBarSender {
counter++;
forceUpdate= true;
}
if (refreshTimer < config.refreshRate() && !forceUpdate){
refreshTimer++;
} else {
if (forceUpdate || refreshTimer >= config.refreshRate()) {
refreshTimer = 0;
DynamicText text = texts[counter % (texts.length)];
updatePrivatePlaceholders();
if (forceUpdate || text.update(privateContext.placeholderMap())) {
if (text.update(privateContext.placeholderMap()) || forceUpdate) {
bossBar.name(AdventureHelper.miniMessage(text.getLatestValue()));
}
bossBar.progress(competition.getProgress());
} else {
refreshTimer++;
}
}, 50, 50, TimeUnit.MILLISECONDS);
}