Search in sources :

Example 6 with Permission

use of net.milkbowl.vault.permission.Permission in project TriggerReactor by wysohn.

the class VaultSupport method setupPermissions.

private boolean setupPermissions() {
    Plugin bukkitPlugin = plugin.getMain();
    RegisteredServiceProvider<Permission> permissionProvider = bukkitPlugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
    if (permissionProvider != null) {
        permission = permissionProvider.getProvider();
    }
    return (permission != null);
}
Also used : Permission(net.milkbowl.vault.permission.Permission) Plugin(org.bukkit.plugin.Plugin)

Example 7 with Permission

use of net.milkbowl.vault.permission.Permission in project Denizen-For-Bukkit by DenizenScript.

the class Depends method setupPermissions.

private boolean setupPermissions() {
    Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("Vault");
    if (plugin == null || !plugin.isEnabled()) {
        return false;
    }
    try {
        RegisteredServiceProvider<Permission> rsp = Bukkit.getServer().getServicesManager().getRegistration(Permission.class);
        permissions = rsp.getProvider();
    } catch (Exception e) {
    }
    return permissions != null;
}
Also used : Permission(net.milkbowl.vault.permission.Permission) Plugin(org.bukkit.plugin.Plugin)

Example 8 with Permission

use of net.milkbowl.vault.permission.Permission in project UltimateChat by FabioZumbi12.

the class UChat method onEnable.

public void onEnable() {
    try {
        uchat = this;
        logger = new UCLogger(this);
        config = new UCConfig(this);
        lang = new UCLang();
        amConfig = new YamlConfiguration();
        // check hooks
        Vault = checkVault();
        SClans = checkSC();
        MarryReloded = checkMR();
        MarryMaster = checkMM();
        ProtocolLib = checkPL();
        PlaceHolderAPI = checkPHAPI();
        Factions = checkFac();
        listener = new UCListener();
        getServer().getPluginCommand("uchat").setExecutor(listener);
        getServer().getPluginManager().registerEvents(listener, this);
        getServer().getPluginManager().registerEvents(new UCChatProtection(), this);
        getServer().getMessenger().registerOutgoingPluginChannel(this, "uChat");
        getServer().getMessenger().registerIncomingPluginChannel(this, "uChat", new UChatBungee());
        // register aliases
        registerAliases();
        if (ProtocolLib) {
            logger.info("ProtocolLib found. Hooked.");
        }
        if (PlaceHolderAPI) {
            try {
                Class.forName("me.clip.placeholderapi.expansion.Relational");
                if (new UCPlaceHoldersRelational(this).register()) {
                    isRelation = true;
                    logger.info("PlaceHolderAPI found. Hooked and registered some chat placeholders with relational tag feature.");
                }
            } catch (ClassNotFoundException ex) {
                if (new UCPlaceHolders(this).register()) {
                    isRelation = false;
                    logger.info("PlaceHolderAPI found. Hooked and registered some chat placeholders.");
                }
            }
        }
        if (MarryReloded) {
            mapi = MarriageAPI.getInstance();
            logger.info("Marriage Reloaded found. Hooked.");
        }
        if (MarryMaster) {
            mm = (MarriageMaster) Bukkit.getPluginManager().getPlugin("MarriageMaster");
            logger.info("MarryMaster found. Hooked.");
        }
        if (SClans) {
            sc = SimpleClans.getInstance();
            logger.info("SimpleClans found. Hooked.");
        }
        if (Vault) {
            RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
            RegisteredServiceProvider<Chat> rschat = getServer().getServicesManager().getRegistration(Chat.class);
            RegisteredServiceProvider<Permission> rsperm = getServer().getServicesManager().getRegistration(Permission.class);
            // Economy
            if (rsp == null) {
                logger.warning("Vault found Economy, but for some reason cant be used.");
            } else {
                econ = rsp.getProvider();
                logger.info("Vault economy found. Hooked.");
            }
            // Chat
            if (rschat == null) {
                logger.warning("Vault found chat, but for some reason cant be used.");
            } else {
                chat = rschat.getProvider();
                logger.info("Vault chat found. Hooked.");
            }
            // Perms
            if (rsperm == null) {
                logger.warning("Vault found permissions, but for some reason cant be used.");
            } else {
                perms = rsperm.getProvider();
                logger.info("Vault perms found. Hooked.");
            }
        }
        logger.info("Init API module...");
        this.ucapi = new uChatAPI();
        // init other features
        // Jedis
        registerJedis();
        // JDA
        registerJDA();
        initAutomessage();
        getUCLogger().info("Server Version: " + getServer().getBukkitVersion());
        getUCLogger().logClear(ChatColor.translateAlternateColorCodes('&', "\n" + "&b  _    _ _ _   _                 _        _____ _           _  \n" + " | |  | | | | (_)               | |      / ____| |         | |  \n" + " | |  | | | |_ _ _ __ ___   __ _| |_ ___| |    | |__   __ _| |_ \n" + " | |  | | | __| | '_ ` _ \\ / _` | __/ _ \\ |    | '_ \\ / _` | __|\n" + " | |__| | | |_| | | | | | | (_| | ||  __/ |____| | | | (_| | |_ \n" + "  \\____/|_|\\__|_|_| |_| |_|\\__,_|\\__\\___|\\_____|_| |_|\\__,_|\\__|\n" + "                                                                \n" + "&a" + getDescription().getFullName() + " enabled!\n"));
        if (this.UCJDA != null) {
            this.UCJDA.sendRawToDiscord(lang.get("discord.start"));
        }
    } catch (Exception e) {
        e.printStackTrace();
        super.setEnabled(false);
    }
}
Also used : API.uChatAPI(br.net.fabiozumbi12.UltimateChat.Bukkit.API.uChatAPI) UChatBungee(br.net.fabiozumbi12.UltimateChat.Bukkit.Bungee.UChatBungee) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) IOException(java.io.IOException) InvalidConfigurationException(org.bukkit.configuration.InvalidConfigurationException) Economy(net.milkbowl.vault.economy.Economy) Chat(net.milkbowl.vault.chat.Chat) Permission(net.milkbowl.vault.permission.Permission) UCConfig(br.net.fabiozumbi12.UltimateChat.Bukkit.config.UCConfig) UCLang(br.net.fabiozumbi12.UltimateChat.Bukkit.config.UCLang)

Aggregations

Permission (net.milkbowl.vault.permission.Permission)8 UserGroup (fr.xephi.authme.data.limbo.UserGroup)2 Player (org.bukkit.entity.Player)2 Plugin (org.bukkit.plugin.Plugin)2 Test (org.junit.Test)2 API.uChatAPI (br.net.fabiozumbi12.UltimateChat.Bukkit.API.uChatAPI)1 UChatBungee (br.net.fabiozumbi12.UltimateChat.Bukkit.Bungee.UChatBungee)1 UCConfig (br.net.fabiozumbi12.UltimateChat.Bukkit.config.UCConfig)1 UCLang (br.net.fabiozumbi12.UltimateChat.Bukkit.config.UCLang)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 BukkitBootstrap (de.dytanic.cloudnet.bridge.BukkitBootstrap)1 IOException (java.io.IOException)1 Chat (net.milkbowl.vault.chat.Chat)1 Economy (net.milkbowl.vault.economy.Economy)1 InvalidConfigurationException (org.bukkit.configuration.InvalidConfigurationException)1 YamlConfiguration (org.bukkit.configuration.file.YamlConfiguration)1 ServicesManager (org.bukkit.plugin.ServicesManager)1