Blackixx / BossShopPro

BossShopPro is one of the most player-friendly and multifunctional GUI plugins ever! Say goodbye to all the annoying command- or signshops!
https://www.spigotmc.org/resources/bossshoppro-the-most-powerful-chest-gui-shop-menu-plugin.222/
MIT License
43 stars 63 forks source link

Loading shops on startup is too late/slow #128

Open MarvinKlar opened 11 months ago

MarvinKlar commented 11 months ago

When starting up the server and joining right after startup I tried to execute a Bossshop command, which caused the following error:

[08:25:59] [Server thread/INFO]: Mr_Minecraft15 joined the game
[08:25:59] [Server thread/INFO]: Mr_Minecraft15[/XXXXXXXX] logged in with entity id 175 at ([doggerland]-1675.4220921459582, 84.9375, 504.31518583701165)
[08:26:13] [Server thread/ERROR]: [ItemJoin_ERROR] {ItemCommand} There was an error executing an item's command as console, if this continues report it to the developer.
[08:26:13] [Server thread/WARN]: org.bukkit.command.CommandException: Unhandled exception executing command 'bs' in plugin BossShopPro v2.0.9
[08:26:13] [Server thread/WARN]:    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47)
[08:26:13] [Server thread/WARN]:    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159)
[08:26:13] [Server thread/WARN]:    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:869)
[08:26:13] [Server thread/WARN]:    at ItemJoin-6.0.3-SNAPSHOT-b916.jar//me.RockinChaos.itemjoin.item.ItemCommand.dispatchConsoleCommands(ItemCommand.java:508)
[08:26:13] [Server thread/WARN]:    at ItemJoin-6.0.3-SNAPSHOT-b916.jar//me.RockinChaos.itemjoin.item.ItemCommand.lambda$sendDispatch$3(ItemCommand.java:462)
[08:26:13] [Server thread/WARN]:    at ItemJoin-6.0.3-SNAPSHOT-b916.jar//me.RockinChaos.itemjoin.item.ItemCommand$$Lambda$9196/0x00000000d5c6fc78.run(Unknown Source)
[08:26:13] [Server thread/WARN]:    at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.run(CraftTask.java:101)
[08:26:13] [Server thread/WARN]:    at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483)
[08:26:13] [Server thread/WARN]:    at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1567)
[08:26:13] [Server thread/WARN]:    at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:490)
[08:26:13] [Server thread/WARN]:    at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1483)
[08:26:13] [Server thread/WARN]:    at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1282)
[08:26:13] [Server thread/WARN]:    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319)
[08:26:13] [Server thread/WARN]:    at net.minecraft.server.MinecraftServer$$Lambda$3658/0x000000007c557d20.run(Unknown Source)
[08:26:13] [Server thread/WARN]:    at java.base/java.lang.Thread.run(Thread.java:883)
[08:26:13] [Server thread/WARN]: Caused by: java.lang.NullPointerException: Cannot invoke "org.black_ixx.bossshop.core.BSShops.getShop(java.lang.String)" because the return value of "org.black_ixx.bossshop.managers.ClassManager.getShops()" is null
[08:26:13] [Server thread/WARN]:    at BossShopPro.jar//org.black_ixx.bossshop.managers.CommandManager.onCommand(CommandManager.java:132)
[08:26:13] [Server thread/WARN]:    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)
[08:26:13] [Server thread/WARN]:    ... 14 more
[08:26:20] [Craft Scheduler Thread - 13 - BossShopPro/INFO]: [BossShopPro] Loaded 323 Shops!
[08:26:20] [Craft Scheduler Thread - 13 - BossShopPro/INFO]: [BossShopPro] Vault found.

I would suggest to either load the shops synchronous on startup or to queue the issued BossShop commands when the plugin is not yet fully loaded.