Skip to content
xZise edited this page Oct 18, 2011 · 2 revisions

First calls

Before you do the first calls you should do something like this:

try {
    if (MinecraftUtil.needUpdate(1, 3)) {
        this.getServer().getLogger().severe("You need to update Bukkit Plugin Utilities to at least 1.3.0");
        this.getServer().getPluginManager().disablePlugin(this);
        return;
    }
    if (!MinecraftUtil.OFFICAL) {
        this.getServer().getLogger().warning("You are using an inoffical version of Bukkit Plugin Utilities.");
    }
} catch (NoSuchMethodError e) {
    this.getServer().getLogger().severe("You need to update Bukkit Plugin Utilities to at least 1.3.0");
    this.getServer().getPluginManager().disablePlugin(this);
    return;
} catch (NoClassDefFoundError e) {
    this.getServer().getLogger().severe("No Bukkit Plugin Utilities found!");
    this.getServer().getPluginManager().disablePlugin(this);
    return;
}

This will inform the user that (s)he has to update Bukkit Plugin Utilities.

The MinecraftUtil.needUpdate(int, int) don't check the third place, because it is only used for bug fixes so a plugin will work with A.B.0 and A.B.1 (guaranteed). This method is also only available since version 1.3 so calls which check versions before 1.3 are senseless!

Clone this wiki locally