BentoBoxWorld/Upgrades

java.lang.NullPointerException: null on upgrade

fjeddy opened this issue · 4 comments

Description

Describe the bug

When you perform an actual upgrade, you get a NullPointerException error in the console, and nothing happens in the game itself.

Steps to reproduce the behavior

/sb upgrade
-> Click to upgrade

Error

java.lang.NullPointerException: null
at world.bentobox.upgrades.upgrades.EntityLimitsUpgrade.doUpgrade(EntityLimitsUpgrade.java:150) ~[?:?]
at world.bentobox.upgrades.ui.PanelClick.onClick(PanelClick.java:28) ~[?:?]
at world.bentobox.bentobox.listeners.PanelListenerManager.lambda$onInventoryClick$0(PanelListenerManager.java:56) ~[?:?]
at java.util.Optional.ifPresent(Unknown Source) ~[?:1.8.0_281]
at world.bentobox.bentobox.listeners.PanelListenerManager.onInventoryClick(PanelListenerManager.java:54) ~[?:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor231.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.16.5.jar:git-Paper-529]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.16.5.jar:git-Paper-529]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.16.5.jar:git-Paper-529]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607) ~[patched_1.16.5.jar:git-Paper-529]
at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:2542) ~[patched_1.16.5.jar:git-Paper-529]
at net.minecraft.server.v1_16_R3.PacketPlayInWindowClick.a(SourceFile:32) ~[patched_1.16.5.jar:git-Paper-529]
at net.minecraft.server.v1_16_R3.PacketPlayInWindowClick.a(SourceFile:10) ~[patched_1.16.5.jar:git-Paper-529]
at net.minecraft.server.v1_16_R3.PlayerConnectionUtils.lambda$ensureMainThread$1(PlayerConnectionUtils.java:23) ~[patched_1.16.5.jar:git-Paper-529]
at net.minecraft.server.v1_16_R3.TickTask.run(SourceFile:18) ~[patched_1.16.5.jar:git-Paper-529]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.16.5.jar:git-Paper-529]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.16.5.jar:git-Paper-529]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.16.5.jar:git-Paper-529]
at net.minecraft.server.v1_16_R3.MinecraftServer.bb(MinecraftServer.java:1138) ~[patched_1.16.5.jar:git-Paper-529]
at net.minecraft.server.v1_16_R3.MinecraftServer.executeNext(MinecraftServer.java:1131) ~[patched_1.16.5.jar:git-Paper-529]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[patched_1.16.5.jar:git-Paper-529]
at net.minecraft.server.v1_16_R3.MinecraftServer.sleepForTick(MinecraftServer.java:1092) ~[patched_1.16.5.jar:git-Paper-529]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1006) ~[patched_1.16.5.jar:git-Paper-529]
Output of /bbox version (Mandatory)
[03:36:16 INFO]: Running PAPER 1.16.5.
[03:36:16 INFO]: BentoBox version: 1.16.0
[03:36:16 INFO]: Database: JSON
[03:36:16 INFO]: Loaded Game Worlds:
[03:36:16 INFO]: bskyblock_world (BSkyBlock): Overworld, Nether, The End
[03:36:16 INFO]: oneblock_world (OneBlock): Overworld, Nether*
[03:36:16 INFO]: skygrid-world (SkyGrid): Overworld, Nether, The End
[03:36:16 INFO]: Loaded Addons:
[03:36:16 INFO]: AOneBlock 1.5.2 (ENABLED)
[03:36:16 INFO]: BSkyBlock 1.14.3 (ENABLED)
[03:36:16 INFO]: Challenges 0.8.4 (ENABLED)
[03:36:16 INFO]: ControlPanel 1.13.0 (ENABLED)
[03:36:16 INFO]: Level 2.6.1 (ENABLED)
[03:36:16 INFO]: Limits 1.15.5 (ENABLED)
[03:36:16 INFO]: MagicCobblestoneGenerator 2.3.0 (ENABLED)
[03:36:16 INFO]: SkyGrid 1.16.0 (ENABLED)
[03:36:16 INFO]: Upgrades 0.2.0-SNAPSHOT-b80 (ENABLED)

It appears this only happens when island-min-level is set to 0, is this intentional? Requering at least level 1?

Pretty sure that's the same error as #38.

When you used the upgrade, where you on your island?
Was it the first thing you did after generating your island?

Hello,

It looks like the same error yes, the error occured on an Island I had been working on for a while, so not new, but, for some reason the Level plugin had issues and /sb level got stuck at calculating and froze. Level didn't work and Upgrades gave the same error.

So I have now re-created everything, including the configs, so yes, I am testing the command the first thing after creating the island.

/sb reset
/sb level
/sb upgrade
-> Click to upgrade
-> Error

The error only happens if island-min-level is set to 0, in other words, I can't let a player upgrade their island limits instantly, they have to reach a minimum of level 1?

Ok, found it.
Actually, the limits addon return a null when the player just created it's island and he didn't place or break any block (or entity).

The reason why it only crash with island_min_level to 0 is because if it's not, you will need to place blocks to increase it

I can add a check with an error message for now.
And I will post an issue on limits