Skip to content

Commit

Permalink
Decrement action bar flags count when removing flag
Browse files Browse the repository at this point in the history
  • Loading branch information
BomBardyGamer committed Oct 16, 2023
1 parent dcf5204 commit 5caf19a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public void incrementFlags() {
this.update();
}

public void decrementFlags() {
this.flags--;
this.update();
}

public void update() {
long now = System.currentTimeMillis();
Duration duration = Duration.ofMillis(now - this.startTime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ private void onClick(@NotNull PlayerBlockInteractEvent event) {
// If the block is already carpet (a flag), we want to remove the flag
instance.setBlock(pos, Block.AIR);
player.playSound(Sound.sound(SoundEvent.ENTITY_ITEM_PICKUP, Sound.Source.MASTER, 0.6F, 1.8F));
this.actionBar.decrementFlags();
return;
}

Expand Down

0 comments on commit 5caf19a

Please sign in to comment.