Skip to content

Commit 049383d

Browse files
authored
Merge pull request #427 from BentoBoxWorld/426_boss_bar_improvements
426 boss bar improvements
2 parents 0c48aa6 + cf560e5 commit 049383d

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/main/java/world/bentobox/aoneblock/listeners/BlockListener.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,9 @@ private void process(@NonNull Cancellable e, @NonNull Island i, @Nullable Player
363363
return;
364364
}
365365

366+
// Increment the block number
367+
is.incrementBlockNumber();
368+
366369
// Break the block
367370
if (e instanceof BlockBreakEvent) {
368371
this.breakBlock(player, block, nextBlock, i);
@@ -381,8 +384,6 @@ private void process(@NonNull Cancellable e, @NonNull Island i, @Nullable Player
381384
Bukkit.getPluginManager().callEvent(new MagicBlockEvent(i, null, null, block, nextBlock.getMaterial()));
382385
}
383386

384-
// Increment the block number
385-
is.incrementBlockNumber();
386387
}
387388

388389
private OneBlockPhase handleGoto(OneBlockIslands is, int gotoBlock) {

src/main/java/world/bentobox/aoneblock/listeners/BossBarListener.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ private void tryToShowBossBar(UUID uuid, Island island) {
117117
int phaseBlocks = addon.getOneBlockManager().getPhaseBlocks(obi);
118118
int done = phaseBlocks - numBlocksToGo;
119119
String translation = user.getTranslationOrNothing("aoneblock.bossbar.status", "[togo]",
120-
String.valueOf(numBlocksToGo), "[total]", String.valueOf(phaseBlocks), "[done]", String.valueOf(done));
120+
String.valueOf(numBlocksToGo), "[total]", String.valueOf(phaseBlocks), "[done]", String.valueOf(done),
121+
"[phase-name]", obi.getPhaseName(), "[percent-done]",
122+
Math.round(addon.getOneBlockManager().getPercentageDone(obi)) + "%");
121123
bar.setTitle(translation);
122124
// Add to user if they don't have it already
123125
Player player = Bukkit.getPlayer(uuid);

src/main/resources/locales/en-US.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ aoneblock:
2222
bossbar:
2323
title: "Blocks remaining"
2424
# status: "&a Phase blocks &b [total]. Blocks left: [todo]"
25+
# status: "&a [phase-name] : [percent-done]"
2526
status: "&a Phase blocks &b [done] &d / &b [total]"
2627
# RED, WHITE, PINK, BLUE, GREEN, YELLOW, or PURPLE
2728
color: RED

0 commit comments

Comments
 (0)