lucko / helper

A collection of utilities and extended APIs to support the rapid and easy development of Bukkit plugins.
MIT License
456 stars 87 forks source link

Citizens hook "NPE" #115

Open byteful opened 3 years ago

byteful commented 3 years ago

I made a plugin using this library and I didn't use any of the NPC features, but during startup I get this error.

[03:00:20 INFO]: [NexEngine] [Hook] Citizens: Success!
[03:00:20 WARN]: java.lang.IllegalArgumentException: Trait name null already registered
[03:00:20 WARN]:        at Citizens.jar//net.citizensnpcs.npc.CitizensTraitFactory.registerTrait(CitizensTraitFactory.java:178)
[03:00:20 WARN]:        at FarmRegeneration-1.0.0.jar//me.byteful.plugin.farmregeneration.lib.lucko.helper.npc.CitizensNpcFactory.registerTrait(CitizensNpcFactory.java:209)
[03:00:20 WARN]:        at FarmRegeneration-1.0.0.jar//me.byteful.plugin.farmregeneration.lib.lucko.helper.npc.CitizensNpcFactory.init(CitizensNpcFactory.java:89)
[03:00:20 WARN]:        at FarmRegeneration-1.0.0.jar//me.byteful.plugin.farmregeneration.lib.lucko.helper.npc.CitizensNpcFactory.lambda$new$1(CitizensNpcFactory.java:81)
[03:00:20 WARN]:        at FarmRegeneration-1.0.0.jar//me.byteful.plugin.farmregeneration.lib.lucko.helper.utils.Delegates$ConsumerToBiConsumerSecond.accept(Delegates.java:150)
[03:00:20 WARN]:        at FarmRegeneration-1.0.0.jar//me.byteful.plugin.farmregeneration.lib.lucko.helper.event.functional.single.HelperEventListener.execute(HelperEventListener.java:136)
[03:00:20 WARN]:        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80)
[03:00:20 WARN]:        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70)
[03:00:20 WARN]:        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:624)
[03:00:20 WARN]:        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:381)
[03:00:20 WARN]:        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500)
[03:00:20 WARN]:        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:535)
[03:00:20 WARN]:        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:449)
[03:00:20 WARN]:        at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:727)
[03:00:20 WARN]:        at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:318)
[03:00:20 WARN]:        at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1216)
[03:00:20 WARN]:        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:321)
[03:00:20 WARN]:        at java.base/java.lang.Thread.run(Thread.java:831)

Seems to happen with any server version compatible with helper so it seems to be a plugin-to-plugin incompatibility. It's most likely "NexEngine" modifying traits in Citizens and then helper attempts to do the same.

PepejHa4ker commented 3 years ago

The helper registers the constant name of the trait. The problem is definitely not in it. https://github.com/lucko/helper/blob/master/helper/src/main/java/me/lucko/helper/npc/CitizensNpcFactory.java#L222