DerPavlov / Cannons

Fire block based Cannons in Minecraft
http://dev.bukkit.org/bukkit-plugins/cannons/
8 stars 35 forks source link

Exception when firing. #14

Closed Golui closed 5 years ago

Golui commented 7 years ago

After upgrading to the latest version, when firing the cannon (or interacting with a block in general) this error is produced.


org.bukkit.event.EventException: null
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-1.12.jar:git-Spigot-596221b-2c5c611]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.12.jar:git-Spigot-596221b-2c5c611]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:499) [spigot-1.12.jar:git-Spigot-596221b-2c5c611]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:484) [spigot-1.12.jar:git-Spigot-596221b-2c5c611]
        at org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:234) [spigot-1.12.jar:git-Spigot-596221b-2c5c611]
        at net.minecraft.server.v1_12_R1.PlayerInteractManager.a(PlayerInteractManager.java:458) [spigot-1.12.jar:git-Spigot-596221b-2c5c611]
        at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:944) [spigot-1.12.jar:git-Spigot-596221b-2c5c611]
        at net.minecraft.server.v1_12_R1.PacketPlayInUseItem.a(PacketPlayInUseItem.java:37) [spigot-1.12.jar:git-Spigot-596221b-2c5c611]
        at net.minecraft.server.v1_12_R1.PacketPlayInUseItem.a(PacketPlayInUseItem.java:1) [spigot-1.12.jar:git-Spigot-596221b-2c5c611]
        at net.minecraft.server.v1_12_R1.PlayerConnectionUtils$1.run(SourceFile:13) [spigot-1.12.jar:git-Spigot-596221b-2c5c611]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_45]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_45]
        at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) [spigot-1.12.jar:git-Spigot-596221b-2c5c611]
        at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:747) [spigot-1.12.jar:git-Spigot-596221b-2c5c611]
        at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:405) [spigot-1.12.jar:git-Spigot-596221b-2c5c611]
        at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:678) [spigot-1.12.jar:git-Spigot-596221b-2c5c611]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:576) [spigot-1.12.jar:git-Spigot-596221b-2c5c611]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45]
Caused by: java.lang.NullPointerException
        at at.pavlov.cannons.listener.PlayerListener.PlayerInteract(PlayerListener.java:385) ~[?:?]
        at sun.reflect.GeneratedMethodAccessor483.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_45]
        at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_45]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[spigot-1.12.jar:git-Spigot-596221b-2c5c611]
        ... 17 more```
DerPavlov commented 7 years ago

The problem should be fixed now. Let me know if the problem persists.

Golui commented 7 years ago

Now it fails to fire entirely. I seem to have gotten it to fire if I remove event.getHand() == EquipmentSlot.OFF_HAND in the initial condition (line 382 in PlayerListener.java), which is probably what you initially meant.

DerPavlov commented 7 years ago

It was firing for me, but strangely it refused loading cobblestone. I changed OFF_HAND back to HAND and it seems to work now.