Hi, I'm new here, so I don't really know all the rules and where to put this, etc. Anyways, I've recently started to learn to make plugins, and I've run into a problem using PlayerInteractEvent. Apparently, when a player clicks on a block, all is fine. However, if a player clicks in the air, I get a "[SEVERE]" error. Here's the error message: Code: 18:25:19 [SEVERE] Could not pass event PlayerInteractEvent to myPlugin org.bukkit.event.EventException at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja va:303) at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav a:62) at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j ava:441) at org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEven t(CraftEventFactory.java:168) at org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEven t(CraftEventFactory.java:138) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:974) at net.minecraft.server.Packet18ArmAnimation.handle(SourceFile:38) at net.minecraft.server.NetworkManager.b(NetworkManager.java:229) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:116) at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:7 8) at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:554) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:452) at net.minecraft.server.ThreadServerApplication.run(SourceFile:490) Caused by: java.lang.NullPointerException at me.scyntrus.MealTime.PlayerListener.onPlayerInteract(PlayerListener.j ava:24) 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.ja va:301) ... 12 more I'm not sure what's causing it, as when the player clicks on a block instead of air it works fine...
Can you post your code for this method: me.scyntrus.MealTime.PlayerListener.onPlayerInteract? Might be able to help more then.
Nvm, after a good couple hours, I figured out that PlayerInteractEvent.getClickedBlock() will return a null object if the player clicked in the air... I though it would return a block object with air, guess I was wrong.