I have a problem at my plugin, config and the inventories. Explanation: These are my inventories. Code (Text): Inventory staffInv = Bukkit.createInventory(null, 54, this.getConfig().getString("GUI.MenuName")); Inventory optionsMenu = Bukkit.createInventory(null, 54, this.getConfig().getString("GUI.OptionsAndStatsMenuName")); When I load them, I receive an error in the console. Yep, the NullPointerException referring to the "this.getConfig()". All config is perfect, and if you want, here's the full code: (The inventories are at the line 735 & 736) https://github.com/MrLechuga/SimpleStaffControl2/blob/master/MClass.java I'll give you a potato if you help me!
It's not. I tested using strings without getting it from config, and it works at this way, but I want that the user can config the menu name. Example: Code (Text): Inventory staffInv = Bukkit.createInventory(null, 54, "Staff List!";
Reload the page, I edited that reply. And the path/config isn't null. I used /test commands that gives me all paths, and all works fine
@SrLegsini your error doesn't match your code (there could be no NPE on the line 335). Rebuild your jar, restart your server, and test again.
The problem is the following: I re-written my code 3 times for the same error. I used different ways to fix it, like making methods for the strings I don't know what to do
Move the initialization of the two inventories to inside the onEnable() method Code (Text): Inventory staffInv = Bukkit.createInventory(null, 54, this.getConfig().getString("GUI.MenuName")); Inventory optionsMenu = Bukkit.createInventory(null, 54, this.getConfig().getString("GUI.OptionsAndStatsMenuName")); make it Code (Text): Inventory staffInv = null; Inventory optionsMenu = null; @Override public void onEnable() { //save config, etc. staffInv = Bukkit.createInventory(null, 54, this.getConfig().getString("GUI.MenuName")); optionsMenu = Bukkit.createInventory(null, 54, this.getConfig().getString("GUI.OptionsAndStatsMenuName")); }