Skip to content

Commit

Permalink
Add update_async action bar option
Browse files Browse the repository at this point in the history
  • Loading branch information
Archy-X committed Jun 8, 2024
1 parent 14f26e3 commit b13e1e2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public enum Option {
ACTION_BAR_PLACEHOLDER_API("action_bar.placeholder_api", OptionType.BOOLEAN),
ACTION_BAR_USE_SUFFIX("action_bar.use_suffix", OptionType.BOOLEAN),
ACTION_BAR_FORMAT_LAST("action_bar.format_last", OptionType.BOOLEAN),
ACTION_BAR_UPDATE_ASYNC("action_bar.update_async", OptionType.BOOLEAN),
// Boss bar options
BOSS_BAR_ENABLED("boss_bar.enabled", OptionType.BOOLEAN),
BOSS_BAR_MODE("boss_bar.mode", OptionType.STRING),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ public void run() {
}
}
};
plugin.getScheduler().timerSync(task, 0, plugin.configInt(Option.ACTION_BAR_UPDATE_PERIOD) * 50L, TimeUnit.MILLISECONDS);
if (plugin.configBoolean(Option.ACTION_BAR_UPDATE_ASYNC)) {
plugin.getScheduler().timerAsync(task, 0, plugin.configInt(Option.ACTION_BAR_UPDATE_PERIOD) * 50L, TimeUnit.MILLISECONDS);
} else {
plugin.getScheduler().timerSync(task, 0, plugin.configInt(Option.ACTION_BAR_UPDATE_PERIOD) * 50L, TimeUnit.MILLISECONDS);
}
}

public void sendXpActionBar(User user, Skill skill, double currentXp, double levelXp, double xpGained, int level, boolean maxed, double income) {
Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ action_bar:
placeholder_api: true
use_suffix: true
format_last: false
update_async: false
boss_bar:
enabled: true
mode: single
Expand Down

0 comments on commit b13e1e2

Please sign in to comment.