Closed GoodestEnglish closed 1 month ago
1.20
So if you try to use BossBar#viewers to loop the current viewers and remove viewers from the BossBar, it doesn't produce the excepted result.
BossBar#viewers
Just try to use this code to test, and you will be able to reproduce the unexcepted result.
@Test void test() { PlayerMock player = server.addPlayer(); BossBar bossBar = BossBar.bossBar(Component.text("hello world"),1, BossBar.Color.RED, BossBar.Overlay.PROGRESS); bossBar.addViewer(player); assertTrue(player.getBossBars().contains(bossBar)); //Passed :D bossBar.viewers().forEach(viewer -> { if (viewer instanceof Player p) { bossBar.removeViewer(p); } }); assertFalse(player.getBossBars().contains(bossBar)); //Failed :( }
No response
I can reproduce this.
We need to register a service for this to work properly
Is there an existing issue for this?
Are you using the latest version of MockBukkit?
Minecraft Version
1.20
Describe the bug
So if you try to use
BossBar#viewers
to loop the current viewers and remove viewers from the BossBar, it doesn't produce the excepted result.Reproducible Test
Just try to use this code to test, and you will be able to reproduce the unexcepted result.
Anything else?
No response