BG-Software-LLC / SSB-IslandNPCs

Create npcs for islands.
2 stars 4 forks source link

NullPointer during IslandSchematicPasteEvent with module SSB-IslandNPCs #1

Closed ZECHEESELORD closed 1 year ago

ZECHEESELORD commented 1 year ago

Minecraft's Version

Current: git-Purpur-1632 (MC: 1.18.2)*

Plugin's Version

Potentially Relevant Information:

Describe the bug

NPC module refuses to work with the SWM module. No NPCs are spawned on world creation/load/join. Stack trace is thrown when player attempts to join an island. Please refer to the logs below for reference:

[20:14:18] [Server thread/INFO]: Hqrxld issued server command: /isles create
[20:14:20] [Server thread/INFO]: [SWM] Creating empty world island_ca2ac2be-4ce9-436e-b093-84561c4c38d6_normal.
[20:14:20] [Server thread/INFO]: [SWM] World island_ca2ac2be-4ce9-436e-b093-84561c4c38d6_normal created in 28ms.
[20:14:20] [Server thread/ERROR]: Could not pass event IslandSchematicPasteEvent to SuperiorSkyblock2 v2022.9
java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "com.bgsoftware.common.reflection.ReflectMethod.invoke(Object, Object[])" is null
    at com.bgsoftware.ssbislandnpcs.npc.citizens.CitizensNPCProvider.createNPC(CitizensNPCProvider.java:66) ~[?:?]
    at com.bgsoftware.ssbislandnpcs.npc.NPCHandler.createNPC(NPCHandler.java:31) ~[?:?]
    at com.bgsoftware.ssbislandnpcs.listeners.IslandsListener.onIslandSchematicPaste(IslandsListener.java:43) ~[?:?]
    at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor433.execute(Unknown Source) ~[?:?]
    at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:75) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
    at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:76) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:git-Purpur-1632]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:671) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
    at com.bgsoftware.superiorskyblock.core.events.EventsBus.callEvent(EventsBus.java:672) ~[SuperiorSkyblock2-2022.9.jar:?]
    at com.bgsoftware.superiorskyblock.core.events.EventsBus.callIslandSchematicPasteEvent(EventsBus.java:483) ~[SuperiorSkyblock2-2022.9.jar:?]
    at com.bgsoftware.superiorskyblock.world.schematic.impl.SuperiorSchematic.lambda$null$5(SuperiorSchematic.java:192) ~[SuperiorSkyblock2-2022.9.jar:?]
    at com.bgsoftware.superiorskyblock.core.threads.BukkitExecutor.ensureMain(BukkitExecutor.java:39) ~[SuperiorSkyblock2-2022.9.jar:?]
    at com.bgsoftware.superiorskyblock.world.schematic.impl.SuperiorSchematic.lambda$pasteSchematic$6(SuperiorSchematic.java:179) ~[SuperiorSkyblock2-2022.9.jar:?]
    at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863) ~[?:?]
    at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841) ~[?:?]
    at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?]
    at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147) ~[?:?]
    at com.bgsoftware.superiorskyblock.world.chunk.ChunksProvider$ChunkLoadWorker.finishLoad(ChunksProvider.java:114) ~[SuperiorSkyblock2-2022.9.jar:?]
    at com.bgsoftware.superiorskyblock.world.chunk.ChunksProvider$ChunkLoadWorker.lambda$work$0(ChunksProvider.java:99) ~[SuperiorSkyblock2-2022.9.jar:?]
    at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863) ~[?:?]
    at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841) ~[?:?]
    at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?]
    at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?]
    at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1163) ~[?:?]
    at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?]
    at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:100) ~[?:?]
    at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?]
    at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1147) ~[?:?]
    at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?]
    at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?]
    at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1163) ~[?:?]
    at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?]
    at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
    at net.minecraft.server.level.ServerChunkCache$MainThreadExecutor.doRunTask(ServerChunkCache.java:1278) ~[?:?]
    at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
    at net.minecraft.server.level.ServerChunkCache$MainThreadExecutor.pollTask(ServerChunkCache.java:1291) ~[?:?]
    at net.minecraft.server.level.ServerChunkCache.pollTask(ServerChunkCache.java:823) ~[?:?]
    at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1415) ~[purpur-1.18.2.jar:git-Purpur-1632]
    at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1397) ~[purpur-1.18.2.jar:git-Purpur-1632]
    at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
    at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1375) ~[purpur-1.18.2.jar:git-Purpur-1632]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1257) ~[purpur-1.18.2.jar:git-Purpur-1632]
    at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:321) ~[purpur-1.18.2.jar:git-Purpur-1632]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]
[20:14:20] [Server thread/ERROR]: Could not pass event ChunkLoadEvent to SuperiorSkyblock2 v2022.9
java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "com.bgsoftware.common.reflection.ReflectMethod.invoke(Object, Object[])" is null
    at com.bgsoftware.ssbislandnpcs.npc.citizens.CitizensNPCProvider.createNPC(CitizensNPCProvider.java:66) ~[?:?]
    at com.bgsoftware.ssbislandnpcs.npc.NPCHandler.createNPC(NPCHandler.java:31) ~[?:?]
    at com.bgsoftware.ssbislandnpcs.listeners.IslandsListener.onIslandChunkLoad(IslandsListener.java:82) ~[?:?]
    at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor436.execute(Unknown Source) ~[?:?]
    at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:75) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
    at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:76) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:git-Purpur-1632]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:671) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
    at net.minecraft.world.level.chunk.LevelChunk.loadCallback(LevelChunk.java:855) ~[?:?]
    at net.minecraft.server.level.ChunkHolder.lambda$updateFutures$19(ChunkHolder.java:762) ~[?:?]
    at net.minecraft.server.level.ChunkMap$CallbackExecutor.run(ChunkMap.java:200) ~[?:?]
    at net.minecraft.server.level.ServerChunkCache$MainThreadExecutor.pollTask(ServerChunkCache.java:1295) ~[?:?]
    at net.minecraft.server.level.ServerChunkCache.pollTask(ServerChunkCache.java:823) ~[?:?]
    at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1415) ~[purpur-1.18.2.jar:git-Purpur-1632]
    at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1397) ~[purpur-1.18.2.jar:git-Purpur-1632]
    at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
    at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1475) ~[purpur-1.18.2.jar:git-Purpur-1632]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1247) ~[purpur-1.18.2.jar:git-Purpur-1632]
    at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:321) ~[purpur-1.18.2.jar:git-Purpur-1632]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]

To Reproduce

Default configurations for both SSB-IslandNPCs as well as SSB were used.

  1. Load server with installation instructions from docs
  2. Install NPC plugin (default configuration used)
  3. create and island (/is create)
  4. error

Additional Information

Default config files were used. Will provide full log files upon request (if required).

OmerBenGera commented 1 year ago

Try building the module again, let me know if it works.

ZECHEESELORD commented 1 year ago

Hi! Thanks for your reply,

I'm not quite sure if its a build issue on my end, but the config.yml file inside the SuperiorSkyblock2/modules/IslandNPCs/config.yml does not seem to be correct. Please refer to the below image.

image

OmerBenGera commented 1 year ago

Hi! Thanks for your reply,

I'm not quite sure if its a build issue on my end, but the config.yml file inside the SuperiorSkyblock2/modules/IslandNPCs/config.yml does not seem to be correct. Please refer to the below image.

image

This is the config file of SSB, not the module

ZECHEESELORD commented 1 year ago

Hi! Thanks for your reply, I'm not quite sure if its a build issue on my end, but the config.yml file inside the SuperiorSkyblock2/modules/IslandNPCs/config.yml does not seem to be correct. Please refer to the below image. image

This is the config file of SSB, not the module

This is the file that is generated within the IslandNPCs directory. I found it odd that the SSB config would be under the modules directory, perhaps this was not intentional?

ZECHEESELORD commented 1 year ago

Odd. Issue seems to have fixed itsself.

Tested a build without file.getParentFile().mkdirs(); [21], which seemed to fix the issue.

After, I used the original build (compiled from this repository), in which the issue did not seem to be present at all.

Marking as resolved.