2013-01-16 11:33:14 +00:00
|
|
|
package de.jaschastarke.minecraft.limitedcreative;
|
|
|
|
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
|
|
|
|
import de.jaschastarke.hooking.BooleanHooker;
|
2013-01-20 12:15:34 +00:00
|
|
|
import de.jaschastarke.hooking.GetHooker;
|
2013-01-16 11:33:14 +00:00
|
|
|
import de.jaschastarke.minecraft.limitedcreative.hooks.AuthMeHooks;
|
|
|
|
import de.jaschastarke.minecraft.limitedcreative.hooks.MultiVerseHooks;
|
2013-09-14 11:53:15 +00:00
|
|
|
import de.jaschastarke.minecraft.limitedcreative.hooks.MultiWorldHooks;
|
2013-01-16 11:33:14 +00:00
|
|
|
import de.jaschastarke.minecraft.limitedcreative.hooks.PlayerCheckHooker;
|
|
|
|
import de.jaschastarke.minecraft.limitedcreative.hooks.WorldTypeHooker;
|
|
|
|
import de.jaschastarke.minecraft.limitedcreative.hooks.xAuthHooks;
|
|
|
|
|
|
|
|
public final class Hooks {
|
|
|
|
public static PlayerCheckHooker IsLoggedIn = new PlayerCheckHooker(true);
|
|
|
|
public static WorldTypeHooker DefaultWorldGameMode = new WorldTypeHooker();
|
|
|
|
public static BooleanHooker IsMultiVerse = new BooleanHooker(false);
|
2013-01-20 12:15:34 +00:00
|
|
|
public static GetHooker<String> InventoryIncompatible = new GetHooker<String>();
|
2013-01-16 11:33:14 +00:00
|
|
|
|
|
|
|
public static boolean isPluginEnabled(String pluginName) {
|
|
|
|
return Bukkit.getServer().getPluginManager().isPluginEnabled(pluginName);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void inizializeHooks(LimitedCreative plugin) {
|
|
|
|
IsLoggedIn.clearHooks();
|
|
|
|
DefaultWorldGameMode.clearHooks();
|
|
|
|
IsMultiVerse.clearHooks();
|
2013-01-20 12:15:34 +00:00
|
|
|
InventoryIncompatible.clearHooks();
|
2013-01-16 11:33:14 +00:00
|
|
|
|
|
|
|
if (isPluginEnabled("AuthMe")) {
|
|
|
|
new AuthMeHooks(plugin);
|
|
|
|
}
|
|
|
|
if (isPluginEnabled("xAuth")) {
|
|
|
|
new xAuthHooks(plugin);
|
|
|
|
}
|
|
|
|
if (isPluginEnabled("Multiverse-Core")) {
|
|
|
|
new MultiVerseHooks(plugin);
|
2013-09-14 11:53:15 +00:00
|
|
|
} else if (isPluginEnabled("MultiWorld")) {
|
|
|
|
new MultiWorldHooks(plugin);
|
2013-01-16 11:33:14 +00:00
|
|
|
}
|
2013-01-20 12:15:34 +00:00
|
|
|
|
|
|
|
InventoryIncompatible.register(new GetHooker.Check<String>() {
|
|
|
|
@Override
|
|
|
|
public String test() {
|
|
|
|
if (isPluginEnabled("MultiInv"))
|
|
|
|
return "MultiInv";
|
|
|
|
if (isPluginEnabled("Multiverse-Inventories"))
|
|
|
|
return "Multiverse-Inventories";
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
});
|
2013-01-16 11:33:14 +00:00
|
|
|
}
|
|
|
|
}
|