UnkownDependencyException - gone after rename... or not!

Discussion in 'Plugin Development' started by silthus, Dec 3, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    silthus

    Hi there,

    I have a really strange problem with some of my self coded plugins. I have two module plugins that depend on the Main plugin, the RaidCraftCore (named like that in the plugin.yml). The two sub plugins extend the main class of the Core plugin and use some of it's util methods. They are named like that:
    RCCoins
    RCSkills
    In both their plugin.yml they have a depend: [RaidCraftCore]
    But when I download them onto my server and but them into the plugin folder it throws this exception:

    Code:
    09:11:45 [SEVERE] Could not load 'plugins/RCSKills.jar' in folder 'plugins': RaidCraftCore
    org.bukkit.plugin.UnknownDependencyException: RaidCraftCore
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135)
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:215)
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136)
            at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:147)
            at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:123)
            at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigurationManager.java:52)
            at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:141)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:388)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:457)
    09:11:45 [SEVERE] Could not load 'plugins/RCCoins.jar' in folder 'plugins': RaidCraftCore
    org.bukkit.plugin.UnknownDependencyException: RaidCraftCore
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135)
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:215)
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136)
            at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:147)
            at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:123)
            at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigurationManager.java:52)
            at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:141)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:388)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:457)
    All three plugins exist and run without problems. When I rename the RaidCraftCore.jar to RaidCraft.jar everything works fine (most of the time) but sometime maybe after three or four (its random) times the plugins suddenly throw that exception again.
    When I rename RaidCraft.jar back to RaidCraftCore.jar again it seems to work.

    Any idea how I can fix this problem (besides renaming the plugins everytime...)?

    Thanks for all your help in advance!
     
  2. Offline

    randomer679

    Try adding:
    depend: [RaidCraftCore]
    to the plugin.yml of both your extension plugins, I have a few plugins I'm working on like this and I had that problem mine went away after adding that though.
     
  3. Offline

    silthus

    It is added... like I said above, thats why this error is so baffling to me.
     
  4. Offline

    Bone008

    Has RaidCraftCore (soft) dependencies itself?
    I had the same problem once. The problem in that case seems to be that when the core plugin is getting loaded before the plugins that it (soft)depends on, it is deferred to enable after everything else. The same happens to your other plugins that depend on the core one.
    So when the rest was loaded, your plugins get enabled, but now bukkit no longer cares about dependency order (if it wasn't enabled yet, bukkit just assumes the dependency was not found). So it can happen that your other plugins enable before the core plugin in the end - which then throws the exception.
     
  5. Offline

    silthus

    Yes the Core has Register as the dependency. Will it work to have the sub plugins depend on register?
     
  6. Offline

    Bone008

    I don't think so, they will still all be deferred and then "randomly" enabled.
    I had the issue with Register as well for DeathControl. Register was loading after my plugin even though I added a soft dependency. That was because Register itself has soft-dependencies for all the economy plugins - so same problem one level shifted.

    It could even be the same for your core plugin, that the dependency for Register isn't found. The way I solved it was to just remove the dependency for Register completely (it was soft, anyways) and design my code not to rely on it being loaded onEnable.
    This is how I've done it, which isn't perfect at all:
    https://github.com/Bone008/DeathCon...08/bukkit/DeathControl/DeathControl.java#L229
    I just ignore if Register is loaded or not and catch the exception when it isn't. The method is called whenever I need to do something with Register.

    I've no idea how you could design it when you actually have to have Register - it is optional for my plugin.
     
    silthus likes this.
  7. Offline

    randomer679

    First: Sorry must have skipped that when I read it ^_^

    Second: There is a "softdepend" and a "depend". The plugin.yml for your main plugin should "depend" on register and then the extensions should "depend" upon the main plugin. The softdepend option is for plugins that can be extended by another plugin but if it is not there it will ignore it and still execute your plugin however you still need to check in your plugin that it is loaded. The depend option forces bukkit to check for the specified plugin and if it exists, load after it otherwise it will just fail to load if the depend plugin does not exist.
     
Thread Status:
Not open for further replies.

Share This Page