garbagemule / MobArena

MobArena plugin for Minecraft
GNU General Public License v3.0
195 stars 151 forks source link

Evoker can't spawn vexes #719

Closed molor closed 2 years ago

molor commented 2 years ago

Bug report

I think that this may be related to recently Spigot's addition of new SpawnReason.SPELL.

Details

Additional info Sorry for not following the issue template, I just want to tell about the problem ASAP and state what I think and what I know. Thanks!

garbagemule commented 2 years ago

Looks like SpawnReason.SPELL was introduced not in 1.18 but in 1.18.1.

We might be able to support this change without breaking backwards compatibility, but that needs to be verified. If we can't support this without hacky string checks or breaking backwards compatibility with 1.13, it's not gonna happen until some time after 0.107.

molor commented 2 years ago

Yeah, it's added in 1.18.1 because I asked for it on Spigot Stash :D Didn't think it could cause problems with MA :c

molor commented 2 years ago

Is there any workaround for this bug now? Can I just "uncancel" entity spawn event with that cause, or MA will not support these vexes anyway?

garbagemule commented 2 years ago

Yeah, it's added in 1.18.1 because I asked for it on Spigot Stash :D

So this is your fault..!

Is there any workaround for this bug now?

Not that I know of. If you uncancel the event, the entity will spawn, but MobArena won't register it. If you're digging into code anyway, I would be very grateful if you could hack up a solution in MobArena and test it out on a 1.13 test server. It should just be an extra if-statement that checks the new value, but if it isn't "overmapped" by Spigot it will probably throw something nasty on older versions.

molor commented 2 years ago

Related PRs (for reference & quick access):

  1. https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/2e61a5f8eb81264737f9ad663eb9ed6616f3a19c
  2. https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/e9f9b5bd4541d5a54c78a299207c39122330a3d4

So this is your fault..!

I'm sorry about that

garbagemule commented 2 years ago

Just took an initial stab at this by simply checking if the spawn reason is the new SPELL value, and on a Paper 1.17.1 server I got this nasty error:

[12:33:19 ERROR]: Could not pass event CreatureSpawnEvent to MobArena v0.106.1-SNAPSHOT
java.lang.NoSuchFieldError: SPELL
    at com.garbagemule.MobArena.ArenaListener.onCreatureSpawn(ArenaListener.java:397) ~[MobArena.jar:?]
    at com.garbagemule.MobArena.listeners.MAGlobalListener.creatureSpawn(MAGlobalListener.java:166) ~[MobArena.jar:?]
    at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor20.execute(Unknown Source) ~[?:?]
    at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.17.1.jar:git-Paper-411]

I'm not entirely sure how the usual remapping works, but it definitely doesn't do much for normal equality checks if it's implemented here. I'll dig a bit more. Might have to resort to using a switch statement, which has historically been kind on enum value branching, or perhaps string equality checks. The latter could be a bit of an issue, because the spawn event is already pretty overloaded :(

garbagemule commented 2 years ago

@molor If you could verify that the issue is resolved in the most recent commit, that would be greatly appreciated 🙏

molor commented 2 years ago

Can confirm that it's fixed, thanks