Search in sources :

Example 16 with RedProtect

use of br.net.fabiozumbi12.RedProtect.Sponge.RedProtect in project RedProtect by FabioZumbi12.

the class HooksManager method registerHooksFirst.

public void registerHooksFirst() {
    try {
        boolean translationApi = checkTAPI();
        boolean infernalMobs = checkIMobs();
        boolean fac = checkFac();
        boolean placeHolderAPI = checkPHAPI();
        boolean mcMMO = checkMcMMo();
        boolean skillAPI = checkSkillAPI();
        if (checkSF4()) {
            RedProtect.get().getServer().getPluginManager().registerEvents(new SlimefunHook(), RedProtect.get());
            RedProtect.get().logger.info("Slimefun found. Hooked.");
        }
        if (checkVault()) {
            // Economy
            RegisteredServiceProvider<Economy> rsp = RedProtect.get().getServer().getServicesManager().getRegistration(Economy.class);
            if (rsp != null) {
                RedProtect.get().economy = rsp.getProvider();
                RedProtect.get().logger.info("Vault Economy found. Hooked.");
            } else {
                RedProtect.get().logger.warning("Could not initialize Vault Economy hook.");
            }
            // Permissions
            RegisteredServiceProvider<Permission> perm = RedProtect.get().getServer().getServicesManager().getRegistration(Permission.class);
            if (perm != null) {
                RedProtect.get().permission = perm.getProvider();
                RedProtect.get().logger.info("Vault Permissions found. Hooked.");
            } else {
                RedProtect.get().logger.warning("Could not initialize Vault Permissions hook.");
            }
        }
        if (infernalMobs) {
            try {
                RedProtect.get().getServer().getPluginManager().registerEvents(new InfernalMobsHook(), RedProtect.get());
                RedProtect.get().logger.info("InfernalMobs found. Hooked.");
            } catch (Exception ex) {
                RedProtect.get().logger.warning("Your InfernalMobs version is NOT compatible and has no API. Look for FabioZumbi12's version on Github!");
            }
        }
        if (checkPvPm()) {
            RedProtect.get().logger.info("PvPManager found. Hooked.");
        }
        if (checkEss()) {
            pless = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials");
            RedProtect.get().logger.info("Essentials found. Hooked.");
        }
        if (checkWe()) {
            RedProtect.get().logger.info("WorldEdit found. Hooked.");
        }
        if (checkWG()) {
            RedProtect rp = RedProtect.get();
            if (rp.bukkitVersion >= 1130) {
                worldGuardHelper = (WorldGuardHelper) Class.forName("br.net.fabiozumbi12.RedProtect.Bukkit.helpers.WorldGuardHelperLatest").newInstance();
            } else {
                worldGuardHelper = (WorldGuardHelper) Class.forName("br.net.fabiozumbi12.RedProtect.Bukkit.helpers.WorldGuardHelper112").newInstance();
            }
            rp.logger.info("WorldGuard version " + worldGuardHelper.getWorldGuardMajorVersion() + " found. Hooked.");
        }
        if (checkAB()) {
            RedProtect.get().logger.info("ActionBarAPI found. Hooked.");
        }
        if (checkBM()) {
            RedProtect.get().logger.info("BossbarAPI found. Hooked.");
        }
        if (checkMyPet()) {
            RedProtect.get().getServer().getPluginManager().registerEvents(new MyPetHook(), RedProtect.get());
            RedProtect.get().logger.info("MyPet found. Hooked.");
        }
        if (mcMMO) {
            RedProtect.get().getServer().getPluginManager().registerEvents(new McMMOHook(), RedProtect.get());
            RedProtect.get().logger.info("mcMMo found. Hooked.");
        }
        if (skillAPI) {
            RedProtect.get().getServer().getPluginManager().registerEvents(new SkillAPIHook(), RedProtect.get());
            RedProtect.get().logger.info("SkillAPI found. Hooked.");
        }
        if (checkMyChunk()) {
            RedProtect.get().logger.success("MyChunk found. Ready to convert!");
            RedProtect.get().logger.warning("Use '/rp mychunkconvert' to start MyChunk conversion (This may cause lag during conversion)");
        }
        if (checkMagicCarpet()) {
            RedProtect.get().logger.info("MagicCarpet found. Hooked.");
        }
        if (checkSC()) {
            clanManager = SimpleClans.getInstance().getClanManager();
            RedProtect.get().logger.info("SimpleClans found. Hooked.");
        }
        if (placeHolderAPI) {
            new PAPIHook().register();
            RedProtect.get().logger.info("PlaceHolderAPI found. Hooked and registered some chat placeholders.");
        }
        if (fac) {
            RedProtect.get().getServer().getPluginManager().registerEvents(new FactionsHook(), RedProtect.get());
            RedProtect.get().logger.info("Factions found. Hooked.");
        }
        if (translationApi) {
            this.transAPI = new TransAPI();
            RedProtect.get().logger.info("TranslationAPI found. Hooked.");
        }
    } catch (Exception e) {
        CoreUtil.printJarVersion();
        e.printStackTrace();
    }
}
Also used : Economy(net.milkbowl.vault.economy.Economy) RedProtect(br.net.fabiozumbi12.RedProtect.Bukkit.RedProtect) Permission(net.milkbowl.vault.permission.Permission)

Aggregations

Player (org.bukkit.entity.Player)7 Region (br.net.fabiozumbi12.RedProtect.Bukkit.Region)6 PlayerRegion (br.net.fabiozumbi12.RedProtect.Core.region.PlayerRegion)4 RedProtect (br.net.fabiozumbi12.RedProtect.Bukkit.RedProtect)3 ParseException (java.text.ParseException)3 SimpleDateFormat (java.text.SimpleDateFormat)3 ClanPlayer (net.sacredlabyrinth.phaed.simpleclans.ClanPlayer)3 ObjectMappingException (ninja.leaping.configurate.objectmapping.ObjectMappingException)3 Location (org.bukkit.Location)3 EventHandler (org.bukkit.event.EventHandler)3 Listener (org.spongepowered.api.event.Listener)3 CommandHandler (br.net.fabiozumbi12.RedProtect.Bukkit.commands.CommandHandler)2 BlockConfig (br.net.fabiozumbi12.RedProtect.Bukkit.config.BlockConfig)2 ConfigManager (br.net.fabiozumbi12.RedProtect.Bukkit.config.ConfigManager)2 LangGuiManager (br.net.fabiozumbi12.RedProtect.Bukkit.config.LangGuiManager)2 LangManager (br.net.fabiozumbi12.RedProtect.Bukkit.config.LangManager)2 RedProtectUtil (br.net.fabiozumbi12.RedProtect.Bukkit.helpers.RedProtectUtil)2 Metrics (br.net.fabiozumbi12.RedProtect.Bukkit.metrics.Metrics)2 RegionManager (br.net.fabiozumbi12.RedProtect.Bukkit.region.RegionManager)2 SpigetUpdater (br.net.fabiozumbi12.RedProtect.Bukkit.updater.SpigetUpdater)2