MegavexNetwork / scoreboard-library

Powerful packet-level scoreboard library for Paper/Spigot servers
https://megavex.net
MIT License
122 stars 13 forks source link

How do I remove a sidebar? #10

Closed Artuto closed 7 months ago

Artuto commented 7 months ago

I am trying to remove the scoreboard then a certain condition is met, however I cannot seem to figure out how to do this, or if it is a bug.

I've tried close(), clearLines() and removing the players but nothing seems to work. Is this intended?

vytskalt commented 7 months ago

.close() should remove it. What MC version are you using?

Artuto commented 7 months ago

1.20.4

vytskalt commented 7 months ago

Sidebar#close() correctly hides the sidebar for me with the modern packet adapter on version 2.0.1. Perhaps you are calling it on a different Sidebar instance?

Artuto commented 7 months ago

I am sure it is the same instance.

[17:06:41 INFO]: [STDOUT] Created net.craftium.libs.scoreboardlibrary.implementation.sidebar.SingleLocaleSidebar@6d3aa730
[17:06:52 INFO]: [STDOUT] Closed net.craftium.libs.scoreboardlibrary.implementation.sidebar.SingleLocaleSidebar@6d3aa730

And in-game looks like this (dont mind the unresolved placeholders):

image

Artuto commented 7 months ago

It seems that calling close() when the plugin is being disabled (inside onDisable) causes this to occur. Is this expected?

vytskalt commented 7 months ago

It seems that calling close() when the plugin is being disabled (inside onDisable) causes this to occur. Is this expected?

Yes, you also need to call ScoreboardLibrary#close in onDisable

Artuto commented 7 months ago

It seems that calling close() when the plugin is being disabled (inside onDisable) causes this to occur. Is this expected?

Yes, you also need to call ScoreboardLibrary#close in onDisable

That did it, thank you!