Magic

Magic

190k Downloads

Casting Arrow Causes Error in Console

purpleskier1 opened this issue · 3 comments

commented

Casting the arrow spell causes this error to show up every single time the arrow is casted. It also allows you to just spam the arrow over and over without cooldown. I'm guessing this has something to do with Purpur since it worked fine when I was using Paper. Thank you!

[03:57:43 ERROR]: Could not pass event PlayerArmSwingEvent to Magic v10.6.1-92a141d
java.lang.NoSuchFieldError: au
at com.elmakers.mine.bukkit.utility.platform.v1_18_2.CompatibilityUtils.decreaseLifespan(CompatibilityUtils.java:837) ~[Magic-10.6.1.jar:?]
at com.elmakers.mine.bukkit.action.builtin.ProjectileAction.start(ProjectileAction.java:185) ~[Magic-10.6.1.jar:?]
at com.elmakers.mine.bukkit.action.CompoundAction.perform(CompoundAction.java:94) ~[Magic-10.6.1.jar:?]
at com.elmakers.mine.bukkit.action.ActionContext.perform(ActionContext.java:43) ~[Magic-10.6.1.jar:?]
at com.elmakers.mine.bukkit.action.ActionHandler.perform(ActionHandler.java:221) ~[Magic-10.6.1.jar:?]
at com.elmakers.mine.bukkit.action.ActionHandler.cast(ActionHandler.java:158) ~[Magic-10.6.1.jar:?]
at com.elmakers.mine.bukkit.spell.ActionSpell.startCast(ActionSpell.java:172) ~[Magic-10.6.1.jar:?]
at com.elmakers.mine.bukkit.spell.ActionSpell.onCast(ActionSpell.java:154) ~[Magic-10.6.1.jar:?]
at com.elmakers.mine.bukkit.spell.BaseSpell.finalizeCast(BaseSpell.java:1737) ~[Magic-10.6.1.jar:?]
at com.elmakers.mine.bukkit.spell.BaseSpell.cast(BaseSpell.java:1534) ~[Magic-10.6.1.jar:?]
at com.elmakers.mine.bukkit.spell.BaseSpell.cast(BaseSpell.java:1410) ~[Magic-10.6.1.jar:?]
at com.elmakers.mine.bukkit.wand.Wand.doCast(Wand.java:5368) ~[Magic-10.6.1.jar:?]
at com.elmakers.mine.bukkit.wand.Wand.cast(Wand.java:5332) ~[Magic-10.6.1.jar:?]
at com.elmakers.mine.bukkit.wand.Wand.cast(Wand.java:5313) ~[Magic-10.6.1.jar:?]
at com.elmakers.mine.bukkit.wand.Wand.performAction(Wand.java:6817) ~[Magic-10.6.1.jar:?]
at com.elmakers.mine.bukkit.magic.listener.PlayerController.onPlayerAnimate(PlayerController.java:704) ~[Magic-10.6.1.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor86.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:75) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:76) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:git-Purpur-1610]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:631) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleAnimate(ServerGamePacketListenerImpl.java:2432) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundSwingPacket.handle(ServerboundSwingPacket.java:25) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundSwingPacket.handle(ServerboundSwingPacket.java:7) ~[?:?]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:51) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[purpur-1.18.2.jar:git-Purpur-1610]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1426) ~[purpur-1.18.2.jar:git-Purpur-1610]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:188) ~[purpur-1.18.2.jar:git-Purpur-1610]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1403) ~[purpur-1.18.2.jar:git-Purpur-1610]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1396) ~[purpur-1.18.2.jar:git-Purpur-1610]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1374) ~[purpur-1.18.2.jar:git-Purpur-1610]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1256) ~[purpur-1.18.2.jar:git-Purpur-1610]
at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:320) ~[purpur-1.18.2.jar:git-Purpur-1610]
at java.lang.Thread.run(Thread.java:833) ~[?:?]

commented

Sorry, this plugin is only compatible with Spigot and Paper.

commented

Looks like the same ABI issue we talked about and fixed in #816 it doesn't seem to have been updated for modern versions (here's the legacy fix, note despawnCounter is now named life but is still moved to Projectile)

commented

Unfortunately it's a little more complicated now because NMSUtils isn't used (since 1.17).

I build directly against the remapped nms now, rather than use reflection. So if Purpur uses different mappings there is really no opportunity for me to fix it. My code is now just this:

    @Override
    public void decreaseLifespan(Projectile projectile, int ticks) {
        net.minecraft.world.entity.Entity nms = ((CraftEntity)projectile).getHandle();
        if (!(nms instanceof net.minecraft.world.entity.projectile.Arrow)) {
            return;
        }
        net.minecraft.world.entity.projectile.Arrow arrow = (net.minecraft.world.entity.projectile.Arrow)nms;
        arrow.life = ticks;
    }