Java Code Examples for org.bukkit.plugin.PluginDescriptionFile#getVersion()

The following examples show how to use org.bukkit.plugin.PluginDescriptionFile#getVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HookWorldGuard.java    From CombatLogX with GNU General Public License v3.0 5 votes vote down vote up
public static WorldGuardVersion getWorldGuardVersion() {
    if(worldGuardVersion != null) return worldGuardVersion;

    PluginManager manager = Bukkit.getPluginManager();
    Plugin plugin = manager.getPlugin("WorldGuard");
    if(plugin == null) return (worldGuardVersion = WorldGuardVersion.ERROR);

    PluginDescriptionFile pdf = plugin.getDescription();
    String version = pdf.getVersion();
    if(version.startsWith("6.1")) return (worldGuardVersion = WorldGuardVersion.V6_1);
    if(version.startsWith("6.2")) return (worldGuardVersion = WorldGuardVersion.V6_2);
    if(version.startsWith("7.0")) return (worldGuardVersion = WorldGuardVersion.V7_0);

    return (worldGuardVersion = WorldGuardVersion.ERROR);
}
 
Example 2
Source File: UpdateChecker.java    From CombatLogX with GNU General Public License v3.0 4 votes vote down vote up
public String getPluginVersion() {
    if(this.pluginVersion != null) return this.pluginVersion;

    PluginDescriptionFile description = this.plugin.getDescription();
    return (this.pluginVersion = description.getVersion());
}
 
Example 3
Source File: SkyBlockHook.java    From CombatLogX with GNU General Public License v3.0 4 votes vote down vote up
public static SkyBlockHook getSkyBlockHook(CompatibilitySkyBlock expansion) {
    if(SKYBLOCK_HOOK != null) return SKYBLOCK_HOOK;

    PluginManager manager = Bukkit.getPluginManager();
    Logger logger = expansion.getLogger();

    if(manager.isPluginEnabled("BentoBox")) {
        Plugin plugin = manager.getPlugin("BentoBox");
        if(plugin != null) {
            PluginDescriptionFile description = plugin.getDescription();
            String version = description.getVersion();
            logger.info("Checking 'BentoBox v" + version + "' for BSkyBlock");
            
            if(HookBentoBox.hookIntoBSkyBlock(logger)) {
                SKYBLOCK_HOOK = new HookBSkyBlock();
                return getSkyBlockHook(expansion);
            }
        }
    }

    if(manager.isPluginEnabled("ASkyBlock")) {
        printHookInfo(expansion, "ASkyBlock");
        SKYBLOCK_HOOK = new HookASkyBlock();
        return getSkyBlockHook(expansion);
    }

    if(manager.isPluginEnabled("FabledSkyBlock")) {
        printHookInfo(expansion, "FabledSkyBlock");
        SKYBLOCK_HOOK = new HookFabledSkyBlock();
        return getSkyBlockHook(expansion);
    }
    
    if(manager.isPluginEnabled("SuperiorSkyblock2")) {
        printHookInfo(expansion, "SuperiorSkyblock2");
        SKYBLOCK_HOOK = new HookSuperiorSkyBlock2();
        return getSkyBlockHook(expansion);
    }

    if(manager.isPluginEnabled("uSkyBlock")) {
        printHookInfo(expansion, "uSkyBlock");
        SKYBLOCK_HOOK = new HookUltimateSkyBlock();
        return getSkyBlockHook(expansion);
    }

    return null;
}