I trying to make shop plugin call "Shopman" but when I ran the server. I got something wrong. Here is my err code: Code (Text): [08:00:57 ERROR]: Error occurred while enabling Shopman v1.0.0 (Is it up to date?) java.lang.NullPointerException at me.chunza2542.shopman.listener.ShopmanInventory.renderInventoryShop(ShopmanInventory.java:31) ~[?:?] at me.chunza2542.shopman.listener.ShopmanInventory.<init>(ShopmanInventory.java:26) ~[?:?] at me.chunza2542.shopman.Shopman.onEnable(Shopman.java:17) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:291) ~[spigot.jar:git-Spigot-7d15d07-c194444] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [spigot.jar:git-Spigot-7d15d07-c194444] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot.jar:git-Spigot-7d15d07-c194444] at org.bukkit.craftbukkit.v1_9_R1.CraftServer.loadPlugin(CraftServer.java:361) [spigot.jar:git-Spigot-7d15d07-c194444] at org.bukkit.craftbukkit.v1_9_R1.CraftServer.enablePlugins(CraftServer.java:321) [spigot.jar:git-Spigot-7d15d07-c194444] at org.bukkit.craftbukkit.v1_9_R1.CraftServer.reload(CraftServer.java:745) [spigot.jar:git-Spigot-7d15d07-c194444] at org.bukkit.Bukkit.reload(Bukkit.java:539) [spigot.jar:git-Spigot-7d15d07-c194444] at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [spigot.jar:git-Spigot-7d15d07-c194444] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigot.jar:git-Spigot-7d15d07-c194444] at org.bukkit.craftbukkit.v1_9_R1.CraftServer.dispatchCommand(CraftServer.java:645) [spigot.jar:git-Spigot-7d15d07-c194444] at org.bukkit.craftbukkit.v1_9_R1.CraftServer.dispatchServerCommand(CraftServer.java:631) [spigot.jar:git-Spigot-7d15d07-c194444] at net.minecraft.server.v1_9_R1.DedicatedServer.aL(DedicatedServer.java:437) [spigot.jar:git-Spigot-7d15d07-c194444] at net.minecraft.server.v1_9_R1.DedicatedServer.D(DedicatedServer.java:401) [spigot.jar:git-Spigot-7d15d07-c194444] at net.minecraft.server.v1_9_R1.MinecraftServer.C(MinecraftServer.java:655) [spigot.jar:git-Spigot-7d15d07-c194444] at net.minecraft.server.v1_9_R1.MinecraftServer.run(MinecraftServer.java:554) [spigot.jar:git-Spigot-7d15d07-c194444] at java.lang.Thread.run(Thread.java:745) [?:1.7.0_79] Here is my Main JavaPlugin class, Shopman.java. shopmanInventory I put this (Shopman) into ShopmanInventory.java constructor method. And Here is my ShopmanInventory.java. When I put the highlighted line into my code It shows me an error. But when I change it to shopman.getLogger().info("YAY"); It does not have any error show in the console. How can I fix this, thx!
That line highlighted is line 31, correct? If so, print in console every object you get (shopman, getShopmanDatabase, etc.) to see what is null.
@RubbaBoy getShopmanDatabase is null but shopman isn't. I think shopman = plugin not = shopman. because when I getLogger is doesn't have any err.
It is most likely the order you are initializing things in. In your onEnable make sure that you register your event class after you initialize your variables in your onEnable.
call registerDataBase first. The shopmanDatabase or whatever is still null at this point so you need to initialise it.