prism / PrismRefracted

A continuation of Prism, a change-tracking plugin for Bukkit-based servers.
Other
44 stars 23 forks source link

[BUG] Could not pass event CreatureSpawnEvent to Prism v3.9.0 #79

Open Dragonte6967 opened 4 months ago

Dragonte6967 commented 4 months ago

Describe the bug Could not pass event CreatureSpawnEvent to Prism v3.9.0 . My server core is paper-1.21

To Reproduce Run this plugin in the paper-1.21 server, it will give an error

Expected behavior Record this event.

Server (please complete the following information):

Additional context Add any other context about the problem here.


[20:36:14 ERROR]: Could not pass event CreatureSpawnEvent to Prism v3.9.0
java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    network/darkhelmet/prism/actions/entity/VillagerSerializer.deserializer(Lorg/bukkit/entity/Entity;)V @13: invokestatic
  Reason:
    Type 'org/bukkit/entity/Villager$Profession' (current frame, stack[2]) is not assignable to 'java/lang/Enum'
  Current Frame:
    bci: @13
    flags: { }
    locals: { 'network/darkhelmet/prism/actions/entity/VillagerSerializer', 'org/bukkit/entity/Entity', 'org/bukkit/entity/Villager' }
    stack: { 'org/bukkit/entity/Villager', 'java/lang/String', 'org/bukkit/entity/Villager$Profession' }
  Bytecode:
    0000000: 2bc0 0009 4d2c 2ab4 0019 b200 47b8 004d
    0000010: c000 07b9 0051 0200 2c2a b400 1bb2 0055
    0000020: b800 4dc0 000c b900 5902 002a b400 1d02
    0000030: 9f00 0d2c 2ab4 001d b900 5d02 002a b400
    0000040: 1f02 9f00 0d2c 2ab4 001f b900 6002 002a
    0000050: 2bb7 0062 b1                           
  Stackmap Table:
    append_frame(@61,Object[#9])
    same_frame(@79)

        at java.base/java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:?]
        at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3549) ~[?:?]
        at java.base/java.lang.Class.getConstructor0(Class.java:3754) ~[?:?]
        at java.base/java.lang.Class.getConstructor(Class.java:2442) ~[?:?]
        at Prism-3.9.0-all.jar/network.darkhelmet.prism.actions.entity.EntitySerializerFactory.getSerializer(EntitySerializerFactory.java:54) ~[Prism-3.9.0-all.jar:?]
        at Prism-3.9.0-all.jar/network.darkhelmet.prism.actions.EntityAction.setEntity(EntityAction.java:49) ~[Prism-3.9.0-all.jar:?]
        at Prism-3.9.0-all.jar/network.darkhelmet.prism.actionlibs.ActionFactory.createEntity(ActionFactory.java:243) ~[Prism-3.9.0-all.jar:?]
        at Prism-3.9.0-all.jar/network.darkhelmet.prism.actionlibs.ActionFactory.createEntity(ActionFactory.java:258) ~[Prism-3.9.0-all.jar:?]
        at Prism-3.9.0-all.jar/network.darkhelmet.prism.actionlibs.ActionFactory.createEntity(ActionFactory.java:227) ~[Prism-3.9.0-all.jar:?]
        at Prism-3.9.0-all.jar/network.darkhelmet.prism.listeners.PrismEntityEvents.onCreatureSpawn(PrismEntityEvents.java:323) ~[Prism-3.9.0-all.jar:?]
        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor56.execute(Unknown Source) ~[?:?]
        at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:?]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:81) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:1.21-105-7e91a2c]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:131) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:628) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.event.CraftEventFactory.callCreatureSpawnEvent(CraftEventFactory.java:794) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at org.bukkit.craftbukkit.event.CraftEventFactory.doEntityAddEventCalling(CraftEventFactory.java:698) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.server.level.ServerLevel.addEntity(ServerLevel.java:1584) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.server.level.ServerLevel.addFreshEntity(ServerLevel.java:1509) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.level.ServerLevelAccessor.lambda$addFreshEntityWithPassengers$0(ServerLevelAccessor.java:16) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at java.base/java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:411) ~[?:?]
        at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[?:?]
        at net.minecraft.world.level.ServerLevelAccessor.addFreshEntityWithPassengers(ServerLevelAccessor.java:16) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.entity.ai.behavior.VillagerMakeLove.breed(VillagerMakeLove.java:130) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.entity.ai.behavior.VillagerMakeLove.tryToGiveBirth(VillagerMakeLove.java:76) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.entity.ai.behavior.VillagerMakeLove.tick(VillagerMakeLove.java:60) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.entity.ai.behavior.VillagerMakeLove.tick(VillagerMakeLove.java:25) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.entity.ai.behavior.Behavior.tickOrStop(Behavior.java:78) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.entity.ai.behavior.GateBehavior.tickOrStop(GateBehavior.java:72) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.entity.ai.Brain.tickEachRunningBehavior(Brain.java:455) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.entity.ai.Brain.tick(Brain.java:404) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.entity.npc.Villager.customServerAiStep(Villager.java:258) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.entity.npc.Villager.customServerAiStep(Villager.java:253) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.entity.Mob.serverAiStep(Mob.java:946) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.entity.LivingEntity.aiStep(LivingEntity.java:3470) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.entity.Mob.aiStep(Mob.java:678) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.entity.AgeableMob.aiStep(AgeableMob.java:155) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.entity.LivingEntity.tick(LivingEntity.java:3173) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.entity.Mob.tick(Mob.java:445) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.entity.npc.Villager.tick(Villager.java:300) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.server.level.ServerLevel.tickNonPassenger(ServerLevel.java:1291) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.level.Level.guardEntityTick(Level.java:1420) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.server.level.ServerLevel.lambda$tick$6(ServerLevel.java:780) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.world.level.entity.EntityTickList.forEach(EntityTickList.java:39) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:760) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1805) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:473) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1597) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1303) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:330) ~[paper-1.21.jar:1.21-105-7e91a2c]
        at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
Bobcat00 commented 4 months ago

Looks to be related to this Spigot change, where enums were changed to interfaces. https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/7983b966630a4224ff7a26e321d2369444d17978#src%2Fmain%2Fjava%2Forg%2Fbukkit%2Fentity%2FVillager.java

From the Paper People:

Yea I presume in their VillagerSerializer? from the looks of it, yea, obviously there is nothing the server can do to fix a plugin still passing these things into a method that expects <T extends Enum<T>>. Same thing goes for EnumMaps. Been in every announcement since 1.17 (or earlier?)