Hello everyone in my plugin controlledcreative, when i utilize one of the events it gives an NPE. It comes from the line on which i call out the config. this goes for all events with the same error. Item Drop event: Code: @EventHandler(priority = EventPriority.HIGHEST) public void ItemDrop(PlayerDropItemEvent event){ Player player = event.getPlayer(); if(!(player.hasPermission(DB))){ if(player.getGameMode() == GameMode.CREATIVE){ boolean drop = plugin.getConfig().getBoolean("Allow-Item-Drop"); //error here(line 69) if(!drop){ event.getItemDrop().getItemStack().getType(); event.setCancelled(true); } } } } Main: Code: package com.gmail.btincher99; import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; public class controlledcreative extends JavaPlugin{ public final Logger logger = Logger.getLogger("Minecraft"); @Override public void onDisable() { PluginDescriptionFile pdfFile = this.getDescription(); this.logger.info(pdfFile.getName() + " Has been disabled"); } @Override public void onEnable() { PluginDescriptionFile pdfFile = this.getDescription(); this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion()"); Bukkit.getServer().getPluginManager().registerEvents(new CCBlockListener(), this); Bukkit.getServer().getPluginManager().registerEvents(new CCPlayerListener(), this); PluginManager pm = this.getServer().getPluginManager(); pm.addPermission(new CCBlockListener().BLB); pm.addPermission(new CCBlockListener().BUB); pm.addPermission(new CCPlayerListener().AB); pm.addPermission(new CCPlayerListener().DB); pm.addPermission(new CCPlayerListener().IB); getConfig().options().copyDefaults(true); saveConfig(); } } config: Code: Allow-Creative-PvP: false Allow-Flying-PvP: false Allow-Item-Drop: false Allow-Chest-Interact: false Allow-Crafting: false Allow-Dispenser-Interact: false Allow-Furnace-Interact: false Allow-Enchanting: false Allow-EndChest-Interact: false Allow-Brewing: false Allow-Anvil-Interact: false Allow-Beacon-Interact: false Allow-Villager-Trading: false Allow-Bedrock: false Allow-Lava: false Allow-Beacon-Place: false Allow-Water: false Allow-TnT-Place: false Error: Code: [SEVERE] Could not pass event PlayerDropItemEvent to ControlledCreative v1.0 org.bukkit.event.EventException at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:427) at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:477) at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462) at net.minecraft.server.v1_4_R1.EntityHuman.a(EntityHuman.java:441) at net.minecraft.server.v1_4_R1.EntityHuman.drop(EntityHuman.java:403) at net.minecraft.server.v1_4_R1.PlayerConnection.a(PlayerConnection.java:1310) at net.minecraft.server.v1_4_R1.Packet107SetCreativeSlot.handle(SourceFile:21) at net.minecraft.server.v1_4_R1.NetworkManager.b(NetworkManager.java:290) at net.minecraft.server.v1_4_R1.PlayerConnection.d(PlayerConnection.java:113) at net.minecraft.server.v1_4_R1.ServerConnection.b(SourceFile:39) at net.minecraft.server.v1_4_R1.DedicatedServerConnection.b(SourceFile:30) at net.minecraft.server.v1_4_R1.MinecraftServer.r(MinecraftServer.java:598) at net.minecraft.server.v1_4_R1.DedicatedServer.r(DedicatedServer.java:224) at net.minecraft.server.v1_4_R1.MinecraftServer.q(MinecraftServer.java:494) at net.minecraft.server.v1_4_R1.MinecraftServer.run(MinecraftServer.java:427) at net.minecraft.server.v1_4_R1.ThreadServerApplication.run(SourceFile:849) Caused by: java.lang.NullPointerException at com.gmail.btincher99.CCPlayerListener.ItemDrop(CCPlayerListener.java:69) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425) ... 16 more
hmmph i seriousely have no clue what to do ive gone over the wiki page still can't figure out what i should do...
What wiki page ? You are calling the wrong listener constructor. Do you know what that means ? You can start by googling "what is constructor in java".
i do know what it is... i just can't figure out what to change it to. and this is the page http://wiki.bukkit.org/Event_API_Reference
I told you everything you need to know. Identify constructors of your listener and see why plugin is null.
I'm sorry but I've tried everything to fix this, I don't know what to do bump EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Check you listener. Does it have a constructor? If so when you initialize your listener follow the constructor's parameters. If the problem persists delete your constructor and initialize it in the onEnable() like this: Code:java getServer().getPluginManager().registerEvents(new BlockBreakLoggerListener(), this);