As of the latest builds of paper and spigot Villager types and profession enums are no longer enums and are instead constants of their interface.
KennyTV
Plugin Developer An upstream update was just merged that moves cat and frog variants, map cursor types, and villager types+profession from enums to constants of an interface. There are basic compatibility measures in place, so you only need to do something now if:
you put any of these into an EnumMap/EnumSet or work on them with switch statements (make sure you also remove such use of them for similar type enums โ),
you are using Paper-plugins (with the paper-plugin.yml), being exempt from the compatibility code, or
you are disabling plugin rewriting via the startup flag.
Going beyond this, please especially make sure you move away from Material.values() calls and instead get them via the Registry API (or the upstream compatible one)
It seems that whatever compatibility mitigations they tried to implement do not work for VillagerOptimizer as it now produces several Badtype on operand stack
errors on startup.
Trimmed Error:
[16:44:32 ERROR]: [VillagerOptimizer] Failed initialising module 'OptimizeByWorkstation'.
java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
me/xginko/villageroptimizer/modules/optimization/OptimizeByWorkstation.lambda$onBlockPlace$2(Ljava/util/concurrent/atomic/AtomicBoolean;Ljava/util/concurrent/atomic/AtomicInteger;Lorg/bukkit/Location;Lorg/bukkit/entity/Villager$Profession;Lorg/bukkit/entity/Player;Lorg/bukkit/event/block/BlockPlaceEvent;Lorg/bukkit/block/Block;Lme/xginko/villageroptimizer/libs/morepaperlib/scheduling/ScheduledTask;)V @336: invokestatic
Reason:
Type 'org/bukkit/entity/Villager$Profession' (current frame, stack[1]) is not assignable to 'java/lang/Enum'
The workaround I have found for now is not update paper past paper-1.21-89. Which is still available on their Builds Explorer