5zig / The-5zig-API

The official client API of The 5zig Mod.
Apache License 2.0
11 stars 2 forks source link

NPE on messages loading (Plugins GUI reload) #19

Open roccodev opened 7 years ago

roccodev commented 7 years ago

I'm getting this NPE when trying to reload my plugin. Could not load Messages from path core/messages/hive.properties java.lang.NullPointerException at java.util.Properties$LineReader.readLine(Properties.java:434) at java.util.Properties.load0(Properties.java:353) at java.util.Properties.load(Properties.java:341) at eu.the5zig.mod.server.RegisteredServerInstance.loadPatterns(RegisteredServerInstance.java:99) at eu.the5zig.mod.server.RegisteredServerInstance.<init>(RegisteredServerInstance.java:41) at eu.the5zig.mod.server.ServerInstanceRegistry.registerServerInstance(ServerInstanceRegistry.java:34) at eu.the5zig.mod.ModAPIImpl.registerServerInstance(ModAPIImpl.java:95) at tk.roccodev.zta.ZTAMain.onLoad(ZTAMain.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at eu.the5zig.mod.plugin.PluginManagerImpl.loadPlugin(PluginManagerImpl.java:141) at eu.the5zig.mod.gui.GuiPlugins.actionPerformed(GuiPlugins.java:91) at eu.the5zig.mod.gui.Gui.actionPerformed0(Gui.java:144) at eu.the5zig.mod.gui.Gui.mouseClicked0(Gui.java:276) at GuiHandle.func_73864_a(GuiHandle.java:58) at net.minecraft.client.gui.GuiScreen.func_146274_d(GuiScreen.java:554) at GuiHandle.func_146274_d(GuiHandle.java:42) at net.minecraft.client.gui.GuiScreen.func_146269_k(GuiScreen.java:523) at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1674) at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1024) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:349) at net.minecraft.client.main.Main.main(SourceFile:124) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

Link to ZTAMain (line 112): https://github.com/RoccoDev/5zig-TIMV-Plugin/blob/79d76b8e13f65889fe783b5d8242e68c60d61316/src/tk/roccodev/zta/ZTAMain.java#L110 (It is Line 110 because my local file is updated)

My core/messages/hive.properties file: https://github.com/RoccoDev/5zig-TIMV-Plugin/blob/experimental/src/core/messages/hive.properties

5zig commented 7 years ago

Are you sure that the properties file was included in your jar and that it was in the correct subdirectory? Or in other words, did your plugin work when relaunching the game?

roccodev commented 7 years ago

It did

roccodev commented 7 years ago

I'm pretty sure it would have thrown a FileNotFoundException instead

roccodev commented 7 years ago

Feel free to download my plugin and test it Make sure to get the latest experimental build

5zig commented 7 years ago

I just downloaded the latest experimental build of your plugin and reloading it in the 5zig mod plugin gui worked perfectly fine for me. My guess is that the NullpointerExecption was caused by classLoader.getResourceAsStream("core/messages/hive.properties ") returning null. Not sure though why I cannot reproduce your issue.

ItsNiklas commented 7 years ago

I just wanna add (I'm also developing on the plugin) that I'm getting the exact same NPE when trying to reload (not on server). So I also have the issue of the whole 'reload' process failing. Relaunching the game works perfectly 😕

5zig commented 7 years ago

Does the reloading always fail or only when the file has been changed before?

ItsNiklas commented 7 years ago

Only if the file has been modified since launching, otherwise it reloads fine