I tried running my plugin on my server, but then the console said I got a NullPointerException. When I checked why, it said I had errors on lines 44 and 152 in my main class. Line 44: Code: @Override public void onEnable(){ String enability = "enabled"; ScoreboardManager sbManager = Bukkit.getScoreboardManager(); Scoreboard sBoard = sbManager.getNewScoreboard(); Inventory wrGadget2Inv = Bukkit.createInventory(null, 9, ChatColor.GREEN + "Choose a gadget!"); Inventory wrGadget1Inv = Bukkit.createInventory(null, 9, ChatColor.GREEN + "Choose a gadget!"); Inventory wrPrimaryInv = Bukkit.createInventory(null, 9, ChatColor.GREEN + "Choose a primary weapon!"); Inventory wrCustomInv = Bukkit.createInventory(null, 9, ChatColor.GREEN + "Choose an item to customize!"); Inventory customizeInv = Bukkit.createInventory(null, 9, ChatColor.GREEN + "Choose a class to customize!"); Inventory AGclassInv = Bukkit.createInventory(null, 9, ChatColor.GREEN + "Choose a Class!"); Team team1 = sBoard.registerNewTeam("Red Team"); Team team2 = sBoard.registerNewTeam("Yellow Team"); (LINE 44)onInventoryClick(null, team1, team2, "enabled", wrGadget2Inv, wrGadget1Inv, wrPrimaryInv, wrCustomInv, customizeInv, AGclassInv); onCommand(null, null, null, "enabled", null); onPlayerQuit(null, team1, team2); int playerCount; playerCount = Bukkit.getOnlinePlayers().length; if(enability == "enabled"){ if(playerCount == 6){ thing1.arenaStart(null, team1, team2); }else if(playerCount <= 5){ thing1.arenaWait(team1, team2); } } } Line 152: Code: @EventHandler public void onInventoryClick(InventoryClickEvent event, Team team1, Team team2, String enability, Inventory wrGadget2Inv, Inventory wrGadget1Inv, Inventory wrPrimaryInv, Inventory wrCustomInv, Inventory customizeInv, Inventory AGclassInv){ if(enability == "enabled"){ (LINE 152)Player player = (Player) event.getWhoClicked(); ItemStack clicked = event.getCurrentItem(); Inventory inventory = event.getInventory(); I'm pretty sure the exception happens on line 44 where I put "null," because that's where the method looks for the InventoryClickEvent. So, what do I put as a placeholder for the event since "null" doesn't work? Also, what is wrong with line 152? Thanks in advance
You're passing null to a method that doesn't check for null before using the parameter. In fact, why you do explicitly call an EventHandler method anyway?
You don't appear to understand how command executors or event handlers work. I suggest you read up here and then try again. http://wiki.bukkit.org/Plugin_Tutorial#Commands http://wiki.bukkit.org/Event_API_Reference You only need the event reference for this issue, but I couldn't help noticing the commands issue too.
es359 Stacktrace (bottom to top): Rocoty I'm calling the eventhandler method because I'm initializing some objects (like teams and inventories) in my onEnable method. After initializing them there, I have to input the to the methods that require them.
While I am new to developing Bukkit plugins, I can assure you that I do know what a method is. I'm not looking for offensive comments, but I am looking for suggestions to help solve my problem.