9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-19 15:09:24 +00:00

fix bossbar

This commit is contained in:
XiaoMoMi
2024-12-18 23:39:05 +08:00
parent 0bedc5d8ca
commit f195311ac5
2 changed files with 7 additions and 3 deletions

View File

@@ -76,11 +76,13 @@ public class ActionBarSender {
this.isShown = true;
senderTask = BukkitCustomFishingPlugin.getInstance().getScheduler().asyncRepeating(() -> {
switchTimer++;
boolean forceUpdate = false;
if (switchTimer > config.switchInterval()) {
switchTimer = 0;
counter++;
forceUpdate = true;
}
if (refreshTimer < config.refreshRate()){
if (refreshTimer < config.refreshRate() && !forceUpdate){
refreshTimer++;
} else {
refreshTimer = 0;

View File

@@ -87,17 +87,19 @@ public class BossBarSender {
this.bossBar.addViewer(audience);
this.senderTask = BukkitCustomFishingPlugin.getInstance().getScheduler().asyncRepeating(() -> {
switchTimer++;
boolean forceUpdate = false;
if (switchTimer > config.switchInterval()) {
switchTimer = 0;
counter++;
forceUpdate= true;
}
if (refreshTimer < config.refreshRate()){
if (refreshTimer < config.refreshRate() && !forceUpdate){
refreshTimer++;
} else {
refreshTimer = 0;
DynamicText text = texts[counter % (texts.length)];
updatePrivatePlaceholders();
if (text.update(privateContext.placeholderMap())) {
if (forceUpdate || text.update(privateContext.placeholderMap())) {
bossBar.name(AdventureHelper.miniMessage(text.getLatestValue()));
}
bossBar.progress(competition.getProgress());