Cannons

Cannons

117k Downloads

Console error "Could not pass event EntityExplodeEvent to"

wolfebersahd opened this issue ยท 10 comments

commented

Steps to reproduce:

  1. Install Cannons and Lands
  2. Fire a cannon in game

But "Could not pass event EntityExplodeEvent to"

[15:30:46] [Server thread/ERROR]: Could not pass event EntityExplodeEvent to Lands v4.5.9.2 java.lang.NullPointerException: null at me.angeschossen.lands.HSYLlcK.hNeKvOf.oDYH(?:142) ~[?:?] at com.destroystokyo.paper.event.executor.MethodHandleEventExecutor.execute(MethodHandleEventExecutor.java:37) ~[patched_1.15.2.jar:git-Paper-284] at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.15.2.jar:git-Paper-284] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.15.2.jar:git-Paper-284] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607) ~[patched_1.15.2.jar:git-Paper-284] at at.pavlov.cannons.CreateExplosion.blockBreaker(CreateExplosion.java:210) ~[?:?] at at.pavlov.cannons.CreateExplosion.detonate(CreateExplosion.java:808) ~[?:?] at at.pavlov.cannons.projectile.ProjectileManager.detonateProjectile(ProjectileManager.java:116) ~[?:?] at at.pavlov.cannons.listener.EntityListener.ProjectileHit(EntityListener.java:75) ~[?:?] at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor44.execute(Unknown Source) ~[?:?] at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.15.2.jar:git-Paper-284] at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.15.2.jar:git-Paper-284] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.15.2.jar:git-Paper-284] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607) ~[patched_1.15.2.jar:git-Paper-284] at org.bukkit.craftbukkit.v1_15_R1.event.CraftEventFactory.callProjectileHitEvent(CraftEventFactory.java:1280) ~[patched_1.15.2.jar:git-Paper-284] at net.minecraft.server.v1_15_R1.EntityProjectile.tick(EntityProjectile.java:118) ~[patched_1.15.2.jar:git-Paper-284] at net.minecraft.server.v1_15_R1.WorldServer.entityJoinedWorld(WorldServer.java:803) ~[patched_1.15.2.jar:git-Paper-284] at net.minecraft.server.v1_15_R1.World.a(World.java:878) ~[patched_1.15.2.jar:git-Paper-284] at net.minecraft.server.v1_15_R1.WorldServer.doTick(WorldServer.java:528) ~[patched_1.15.2.jar:git-Paper-284] at net.minecraft.server.v1_15_R1.MinecraftServer.b(MinecraftServer.java:1316) ~[patched_1.15.2.jar:git-Paper-284] at net.minecraft.server.v1_15_R1.DedicatedServer.b(DedicatedServer.java:430) ~[patched_1.15.2.jar:git-Paper-284] at net.minecraft.server.v1_15_R1.MinecraftServer.a(MinecraftServer.java:1170) ~[patched_1.15.2.jar:git-Paper-284] at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:959) ~[patched_1.15.2.jar:git-Paper-284] at java.lang.Thread.run(Unknown Source) [?:1.8.0_251]

Sent this to the Lands plugins dev and he replied with.
lands-cannons

Paper-284 for MC 1.15.2
Lands: latest
Cannons: Latest

commented

latest.log

We did a more thorough test with debug on. It seems that Lands can't understand the way cannons handles the "penetration" option.

Don't know if this is helpful, but WG's passthrough deny flag protects from it 100%

commented

we tried this... it seems to have worked for us

Entity entity = world.spawnEntity(impactLoc, projectile.getProjectileEntity());

                                // create bukkit event
                                EntityExplodeEvent event = new EntityExplodeEvent(entity, impactLoc, piercingEvent.getBlockList(), 1.0f);

It would probably need to be changed everywhere there's an EntityExplodeEvent.
https://github.com/DerPavlov/Cannons/search?q=EntityExplodeEvent&unscoped_q=EntityExplodeEvent

A friend also suggested this... not sure if it helps you.
pom.txt

commented

I assume Lands is a block protection plugin. Do you have a link?
In my opinion, the problem is a missing 'null' check on the side of Lands. I fire the event with the snowball a entity and remove the entity afterwards.
Can you contact the developers of Lands and ask them to check this issue?

commented

Hello,

The plugin is initiating a entity explode event with null as the entity paramenter:

EntityExplodeEvent event = new EntityExplodeEvent(null, impactLoc, piercingEvent.getBlockList(), 1.0f);

As you can see here in the docs this parameter is declared as NotNull, which means that you shouldn't set null:
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityExplodeEvent.html#EntityExplodeEvent-org.bukkit.entity.Entity-org.bukkit.Location-java.util.List-float-

With the conventions, this value should never be or set to null.

commented

Most plugins do accept it. In my opinion it gives better results than setting the entity to snowballs.

commented

I know that WorldGuard, Factions (MassiveCore), Towny, and GriefPrevention accept it. Those are the ones I've used with Cannons in the past.

I also thing the EntityExplodeEvent(null but be present in other plugins like CrackShot, QualityArmory, and other guns/cannons plugins. I'm just speculating this, but i could ask the devs i know some of them.

commented

I could not find a better solution and it is problem every explosion plugin has.

commented

I added a check for your plugin. This can be closed now.

commented

This is still an issue for any plugin listening to EntityExplodeEvents. As per @Angeschossen comment above, the EntityExplodeEvent's Entity is @NotNull and the use in Cannons is violating that contract with the event.

You should be subbing in an entity (I believe you already have a snowball in play here anyways.)