-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
None
-
This server is running CraftBukkit version git-Spigot-5e4e7f3-2349feb (MC: 1.14.3) (Implementing API version 1.14.3-R0.1-SNAPSHOT)
-
Yes
This may be related to SPIGOT-4789.
When running a plugin that uses LingeringPotionSplashEvent that has been compiled using the 1.13.2 API on a 1.14.3 server, any methods called on getEntity() result in a java.lang.NoSuchMethodError. Running on 1.13.x servers is fine. However, if the plugin is compiled using the 1.14.3 API and run on a 1.13.2 server, the same error occurs. It seems there is a binary incompatibility between versions for this specific getEntity() method in this event. I checked the parent ProjectileHitEvent and everything seems to work there.
Is there anyway to have compatibility between versions or must I have two versions of the plugin, one for 1.13.2 servers (currently the majority of users) and one for 1.14.x servers?
public class Test extends JavaPlugin implements Listener { @Override public void onEnable(){ Bukkit.getPluginManager().registerEvents(this, this); } @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled=true) public void onSomething(LingeringPotionSplashEvent e) { Bukkit.getLogger().info("Event name = " + e.getEventName()); // These lines below will cause an error Bukkit.getLogger().info("Thrown Potion = " + e.getEntity().getUniqueId()); Bukkit.getLogger().info("Shooter = " + e.getEntity().getShooter()); } }
Error:
[16:13:41] [Server thread/INFO]: Event name = LingeringPotionSplashEvent [16:13:41] [Server thread/ERROR]: Could not pass event LingeringPotionSplashEvent to Test v1.0.0 org.bukkit.event.EventException: null at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:320) ~[spigot.jar:git-Spigot-5e4e7f3-2349feb] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[spigot.jar:git-Spigot-5e4e7f3-2349feb] at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:529) ~[spigot.jar:git-Spigot-5e4e7f3-2349feb] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:514) ~[spigot.jar:git-Spigot-5e4e7f3-2349feb] at org.bukkit.craftbukkit.v1_14_R1.event.CraftEventFactory.callLingeringPotionSplashEvent(CraftEventFactory.java:654) ~[spigot.jar:git-Spigot-5e4e7f3-2349feb] at net.minecraft.server.v1_14_R1.EntityPotion.a(EntityPotion.java:215) ~[spigot.jar:git-Spigot-5e4e7f3-2349feb] at net.minecraft.server.v1_14_R1.EntityPotion.a(EntityPotion.java:90) ~[spigot.jar:git-Spigot-5e4e7f3-2349feb] at net.minecraft.server.v1_14_R1.EntityProjectile.tick(EntityProjectile.java:109) ~[spigot.jar:git-Spigot-5e4e7f3-2349feb] at net.minecraft.server.v1_14_R1.WorldServer.entityJoinedWorld(WorldServer.java:570) ~[spigot.jar:git-Spigot-5e4e7f3-2349feb] at net.minecraft.server.v1_14_R1.World.a(World.java:745) [spigot.jar:git-Spigot-5e4e7f3-2349feb] at net.minecraft.server.v1_14_R1.WorldServer.doTick(WorldServer.java:346) [spigot.jar:git-Spigot-5e4e7f3-2349feb] at net.minecraft.server.v1_14_R1.MinecraftServer.b(MinecraftServer.java:1057) [spigot.jar:git-Spigot-5e4e7f3-2349feb] at net.minecraft.server.v1_14_R1.DedicatedServer.b(DedicatedServer.java:396) [spigot.jar:git-Spigot-5e4e7f3-2349feb] at net.minecraft.server.v1_14_R1.MinecraftServer.a(MinecraftServer.java:959) [spigot.jar:git-Spigot-5e4e7f3-2349feb] at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:804) [spigot.jar:git-Spigot-5e4e7f3-2349feb] at java.lang.Thread.run(Thread.java:834) [?:?] Caused by: java.lang.NoSuchMethodError: org.bukkit.event.entity.LingeringPotionSplashEvent.getEntity()Lorg/bukkit/entity/LingeringPotion; at world.bentobox.test.Test.onSomething(Test.java:22) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:316) ~[spigot.jar:git-Spigot-5e4e7f3-2349feb] ... 15 more