Softdepend worldguard still requires worldguard ?!

Discussion in 'Plugin Development' started by hmmcrunchy, Mar 3, 2015.

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

    hmmcrunchy

    hi all just wondered If you could help me with this little error

    I have a softdepend: [ScoreboardStats,WorldGuard,WorldEdti] in my plugin.yml

    then in the plugin I use

    import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
    import com.sk89q.worldguard.protection.ApplicableRegionSet;
    import com.sk89q.worldedit.BlockVector;
    import com.sk89q.worldguard.bukkit.WGBukkit;
    import com.sk89q.worldguard.protection.flags.DefaultFlag;
    import com.sk89q.worldguard.protection.flags.StateFlag;
    import com.sk89q.worldguard.protection.regions.ProtectedRegion;

    then on enable
    Code:
    if(worldGuardEnabled==true)
            {
                       
                if(this.getServer().getPluginManager().getPlugin("WorldGuard")!=null)
                {
                    getLogger().info("World Guard Enabled");
    
                }else{
                    worldGuardEnabled = false;
                    getLogger().info("Error - World Guard not linked");
                }
            }else{
                getLogger().info("World Guard disabled in config");
            }
    then various other items in the plugin that call worldguard but only if the Boolean worldGuardEnabled is true as defined by my config file.

    issue I have is:
    if worldguard plugiu is In plugin folder and worldGuardEnabled is true= works fine
    if worldguard plugiu is In plugin folder and worldGuardEnabled is false= disables WG and plugin works fine

    if worldguard plugiu is not in plugin folder and worldGuardEnabled is true or false = plugin on startup says in console failed to register events for class xxxmypluginxx because com/sk89q/worldguard/bukkit/WordGuardPlugin does not exist

    surely being softdepend and the fact im only calling anything to do with worldguard if my variable worldGuardEnabled is true would stop the plugin calling worldguard so it wouldn't matter if it wasn't there but it seems to break all the listeners in my plugin so it enables but no player login events etc will work

    any idea why the softdepend isn't working would be most appreciated

    thanks
     
  2. Offline

    1Rogue

    softdepend has nothing to do with it, you tried to resolve a class that doesn't exist because worldguard isn't a loaded plugin
     
  3. Offline

    hmmcrunchy

    Hey rogue, thanks for reply

    forgive my ignorance so just the fact ive called the import for the worldguard means it will error, I do exactly the same for Scorboardstats and if its not there it just quietly does nothing with no errors
     
  4. Offline

    1Rogue

    importing doesn't make a difference, it's when you actually attempt to utilize any aspect of the class (or even store a reference of the class type) you will have this error.
     
  5. Offline

    hmmcrunchy

    thanks again, ill go through each area and see where I have stumbled into utilising any part of it, I thought id made it so if the variable was false then no WG code would be run but I must have made error somewhere

    thanks for advice :)
     
Thread Status:
Not open for further replies.

Share This Page