KAMKEEL / CustomNPC-Plus

Custom Version of 1.7.10 CustomNPC with backported features and original expansions
https://www.curseforge.com/minecraft/mc-mods/customnpc-plus
Other
53 stars 34 forks source link

A null pointer exception (in script) when calling customGuiSlot(event) manually. #98

Closed 20Whey closed 8 months ago

20Whey commented 1 year ago

Issue description:

If crashed, link to crash report (use a site such as pastebin): Sun Jun 11 14:10:51 BST 2023 tab 2: java.lang.NullPointerException at noppes.npcs.NoppesStringUtils.formatText(NoppesStringUtils.java:33) at noppes.npcs.scripted.entity.ScriptPlayer.sendMessage(ScriptPlayer.java:342) at jdk.nashorn.internal.scripts.Script$Recompilation$502$38A$\^eval_.customGuiSlotClicked(:35) at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:638) at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:229) at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:387) at jdk.nashorn.api.scripting.ScriptObjectMirror.callMember(ScriptObjectMirror.java:192) at jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:381) at jdk.nashorn.api.scripting.NashornScriptEngine.invokeFunction(NashornScriptEngine.java:187) at noppes.npcs.controllers.ScriptContainer.run(ScriptContainer.java:197) at noppes.npcs.controllers.ScriptContainer.run(ScriptContainer.java:146) at noppes.npcs.controllers.data.PlayerDataScript.callScript(PlayerDataScript.java:89) at noppes.npcs.controllers.CustomGuiController.onSlotClick(CustomGuiController.jav a:95) at noppes.npcs.EventHooks.onCustomGuiSlotClicked(EventHooks.java:567) at noppes.npcs.containers.ContainerCustomGui.func_75144_a(ContainerCustomGui.java:122) at net.minecraft.network.NetHandlerPlayServer.func_147351_a(NetHandlerPlayServer.java:883) at net.minecraft.network.play.client.C0EPacketClickWindow.func_148833_a(SourceFile:32) at net.minecraft.network.play.client.C0EPacketClickWindow.func_148833_a(SourceFile:10) at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212) at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:165) at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:659) at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:547) at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:111) at fastcraft.u.a(F:289) at fastcraft.H.aq(F:36) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:396) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685)

Versions: 1.8.5

Can it be reproduced with just CustomNPC+? If not, list the other mods required to reproduce the issue.

https://github.com/KAMKEEL/CustomNPC-Plus/assets/31368984/7c837d25-41d5-41b5-bc35-4dfe8c5907f0

a:95)

20Whey commented 1 year ago

this combined with the previous issue I brought up, make custom ui's pretty difficult to work with. hoping for a fix soon :o

Goodbird-git commented 9 months ago

As far as I see, the NullPointerException occured in the sendMessage method image The method formatString, which was called by sendMessage, throws NullPointerException in 33rd line only when the message, passed to it (and it recieves sendMessage's message) is null. So I think that you accidently passed null to the sendMessage method here image And that's the reason of that NullPointerException problem

20Whey commented 9 months ago

I'll have to retry this code, I'm fairly certain I must have pasted the wrong error in a while back as this was one of many iterations of trying to have this feature work

Apologies though

KAMKEEL commented 8 months ago

@20Whey Please retry and reopen if still occurring (Try latest beta)