Skip to content

Commit

Permalink
fix: add check to BossBar#addViewer and BossBar#removeViewer
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed Oct 13, 2024
1 parent 9741530 commit bee9b89
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public class AllayBossBar implements BossBar {

@Override
public void addViewer(EntityPlayer viewer) {
if (viewers.contains(viewer)) {
return;
}

viewers.add(viewer);
var pk = new BossEventPacket();
pk.setBossUniqueEntityId(viewer.getRuntimeId());
Expand All @@ -46,6 +50,10 @@ public void addViewer(EntityPlayer viewer) {

@Override
public void removeViewer(EntityPlayer viewer) {
if (!viewers.contains(viewer)) {
return;
}

viewers.remove(viewer);
var pk = new BossEventPacket();
pk.setBossUniqueEntityId(viewer.getRuntimeId());
Expand Down

0 comments on commit bee9b89

Please sign in to comment.