aematsubara / Roulette

The classic casino game now in Minecraft, no need for texture packs.
https://www.spigotmc.org/resources/roulette.82197/
GNU General Public License v3.0
7 stars 8 forks source link

Fix Unregistered scoreboard component error #17

Closed Zoiter7 closed 1 year ago

Zoiter7 commented 1 year ago

There is an error when you create a roulette table, the issue happens with some plugin manipulating scoreboards, a compatibility problem.

Is due because can't register an empty component, so in this case for avoid empty name for the NPC, will get the unnamed name croupier from config.

Caused by: java.lang.IllegalStateException: Unregistered scoreboard component at org.bukkit.craftbukkit.v1_19_R1.scoreboard.CraftTeam.checkState(CraftTeam.java:403) ~[paper-1.19.2.jar:git-Paper-131] at org.bukkit.craftbukkit.v1_19_R1.scoreboard.CraftTeam.addEntry(CraftTeam.java:232) ~[paper-1.19.2.jar:git-Paper-131] at me.matsubara.roulette.game.Game.setNPC(Game.java:208) ~[Roulette-1.9.1-SNAPSHOT.jar:?] at me.matsubara.roulette.game.Game.<init>(Game.java:140) ~[Roulette-1.9.1-SNAPSHOT.jar:?] at me.matsubara.roulette.manager.GameManager.add(GameManager.java:81) ~[Roulette-1.9.1-SNAPSHOT.jar:?] at me.matsubara.roulette.manager.GameManager.add(GameManager.java:53) ~[Roulette-1.9.1-SNAPSHOT.jar:?] at me.matsubara.roulette.command.Main.onCommand(Main.java:144) ~[Roulette-1.9.1-SNAPSHOT.jar:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?] ... 23 more

This fix has been tested.

Zoiter7 commented 1 year ago

I added a new cheking for check if the team is registered, because if is not registered throws a null error when you join to the game or click at the npc.

I have a scoreboard plugin and I think the team is registered on load but when the scoreboard plugin loads clears the previous teams or some plugin is clearing empty teams after x time (NameTagEdit for e.g).