EchoPet

EchoPet

882k Downloads

Error occoured while enabling Echopet (multiple worlds)

MarkLyck opened this issue ยท 2 comments

commented

I'm getting an error on startup.

[09:16:16] [Server thread/ERROR]: Error occurred while enabling EchoPet v2.2.5-SNAPSHOT (Is it up to date?)
java.lang.IllegalArgumentException: Can not set final org.bukkit.command.SimpleCommandMap field org.bukkit.plugin.SimplePluginManager.commandMap to me.Incomprehendable.WorldPlugins.FakePluginManager
    at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source) ~[?:1.7.0_51]
    at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source) ~[?:1.7.0_51]
    at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(Unknown Source) ~[?:1.7.0_51]
    at sun.reflect.UnsafeQualifiedObjectFieldAccessorImpl.get(Unknown Source) ~[?:1.7.0_51]
    at java.lang.reflect.Field.get(Unknown Source) ~[?:1.7.0_51]
    at io.github.dsh105.echopet.reflection.SafeField.get(SafeField.java:68) ~[?:?]
    at io.github.dsh105.echopet.commands.util.CommandManager.getCommandMap(CommandManager.java:60) ~[?:?]
    at io.github.dsh105.echopet.commands.util.CommandManager.register(CommandManager.java:31) ~[?:?]
    at io.github.dsh105.echopet.EchoPetPlugin.onEnable(EchoPetPlugin.java:211) ~[?:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:250) ~[spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:350) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:390) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    at me.Incomprehendable.WorldPlugins.FakePluginManager.enablePlugin(FakePluginManager.java:238) [PerWorldPlugins.jar:?]
    at org.bukkit.craftbukkit.v1_7_R1.CraftServer.loadPlugin(CraftServer.java:460) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    at org.bukkit.craftbukkit.v1_7_R1.CraftServer.enablePlugins(CraftServer.java:380) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    at net.minecraft.server.v1_7_R1.MinecraftServer.m(MinecraftServer.java:348) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    at net.minecraft.server.v1_7_R1.MinecraftServer.g(MinecraftServer.java:325) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    at net.minecraft.server.v1_7_R1.MinecraftServer.a(MinecraftServer.java:281) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    at net.minecraft.server.v1_7_R1.DedicatedServer.init(DedicatedServer.java:186) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:437) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]

I think it might have something to do with:
http://dev.bukkit.org/bukkit-plugins/perworldplugins/

hope there's a fix for this :0

Thanks for your help!

Regards:
Mark

commented

their post does however mention:

  • Because it injects a customized PluginManager into the Bukkit core, PerWorldPlugins will appear during errors. This does not mean that PWP is the issue. Make sure that you can read stack traces well enough to determine whether or not the issue is from my end
commented

They also have this information, which I believe is the source of the problem:

Developers

API: Currently we don't support one. If you want one, suggest the features you want!

If your plugin is incompatible, it is mainly because the plugin might extend to SimplePluginManager. PerWorldPlugins will not extend to that class due to its protection; how can you expect us to do so without some more l33t hacky code manipulation?

Here's an example on how to fix it:

Before: (incompatible)

SimplePluginManager spm = (SimplePluginManager)Bukkit.getServer().getPluginManager();
Field scmF = spm.getClass().getDeclaredField("commandMap");

After: (compatible!)

PluginManager pm = Bukkit.getServer().getPluginManager();
Field scmF = pm.getClass().getDeclaredField("commandMap");

Done! That's it. Even as a bonus, if someone decides to make another PluginManager, your plugin will already work with it.