Package net.milkbowl.vault.permission

Examples of net.milkbowl.vault.permission.Permission


        hookPermission("rscPermissions", Permission_rscPermissions.class, ServicePriority.Normal, "ru.simsonic.rscPermissions.MainPluginClass");

        // Try to load KPerms
        hookPermission("KPerms", Permission_KPerms.class, ServicePriority.Normal, "com.lightniinja.kperms.KPermsPlugin");

        Permission perms = new Permission_SuperPerms(this);
        sm.register(Permission.class, perms, this, ServicePriority.Lowest);
        log.info(String.format("[Permission] SuperPermissions loaded as backup permission system."));

        this.perms = sm.getRegistration(Permission.class).getProvider();
    }
View Full Code Here


    }

    private void hookPermission (String name, Class<? extends Permission> hookClass, ServicePriority priority, String...packages) {
        try {
            if (packagesExists(packages)) {
                Permission perms = hookClass.getConstructor(Plugin.class).newInstance(this);
                sm.register(Permission.class, perms, this, priority);
                log.info(String.format("[Permission] %s found: %s", name, perms.isEnabled() ? "Loaded" : "Waiting"));
            }
        } catch (Exception e) {
            log.severe(String.format("[Permission] There was an error hooking %s - check to make sure you're using a compatible version!", name));
        }
    }
View Full Code Here

        // Get String of Registered Permission Services
        String registeredPerms = null;
        Collection<RegisteredServiceProvider<Permission>> perms = this.getServer().getServicesManager().getRegistrations(Permission.class);
        for (RegisteredServiceProvider<Permission> perm : perms) {
            Permission p = perm.getProvider();
            if (registeredPerms == null) {
                registeredPerms = p.getName();
            } else {
                registeredPerms += ", " + p.getName();
            }
        }

        String registeredChats = null;
        Collection<RegisteredServiceProvider<Chat>> chats = this.getServer().getServicesManager().getRegistrations(Chat.class);
        for (RegisteredServiceProvider<Chat> chat : chats) {
            Chat c = chat.getProvider();
            if (registeredChats == null) {
                registeredChats = c.getName();
            } else {
                registeredChats += ", " + c.getName();
            }
        }

        // Get Economy & Permission primary Services
        RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
        Economy econ = null;
        if (rsp != null) {
            econ = rsp.getProvider();
        }
        Permission perm = null;
        RegisteredServiceProvider<Permission> rspp = getServer().getServicesManager().getRegistration(Permission.class);
        if (rspp != null) {
            perm = rspp.getProvider();
        }
        Chat chat = null;
        RegisteredServiceProvider<Chat> rspc = getServer().getServicesManager().getRegistration(Chat.class);
        if (rspc != null) {
            chat = rspc.getProvider();
        }
        // Send user some info!
        sender.sendMessage(String.format("[%s] Vault v%s Information", getDescription().getName(), getDescription().getVersion()));
        sender.sendMessage(String.format("[%s] Economy: %s [%s]", getDescription().getName(), econ == null ? "None" : econ.getName(), registeredEcons));
        sender.sendMessage(String.format("[%s] Permission: %s [%s]", getDescription().getName(), perm == null ? "None" : perm.getName(), registeredPerms));
        sender.sendMessage(String.format("[%s] Chat: %s [%s]", getDescription().getName(), chat == null ? "None" : chat.getName(), registeredChats));
    }
View Full Code Here

    public List<String> getPermUserNames() {
        if (!(permissionsAvailable())) {
            return new ArrayList<String>(0);
        }
        ServicesManager sm = Bukkit.getServicesManager();
        Permission p = sm.getRegistration(Permission.class).getProvider();
        List<String> result = new ArrayList<String>();
        for (Player player : Bukkit.getOnlinePlayers()) {
            if (p.getPlayerGroups(player) != null && p.getPlayerGroups(player)[0] != null) {
                result.add(player.getName());
            }
        }
        return result;
    }
View Full Code Here

    public List<String> getPermUserNamesForWorld(String world) {
        if (!(permissionsAvailable())) {
            return new ArrayList<String>(0);
        }
        ServicesManager sm = Bukkit.getServicesManager();
        Permission p = sm.getRegistration(Permission.class).getProvider();
        List<String> result = new ArrayList<String>();
        for (Player player : Bukkit.getOnlinePlayers()) {
            String playerName = player.getName();
            if (p.getPlayerGroups(world, playerName) != null && p.getPlayerGroups(world, playerName).length > 0) {
                result.add(playerName);
            }
        }
        return result;
    }
View Full Code Here

    public List<String> getPermGroupNames() {
        if (!(permissionsAvailable())) {
            return new ArrayList<String>(0);
        }
        ServicesManager sm = Bukkit.getServicesManager();
        Permission p = sm.getRegistration(Permission.class).getProvider();
        return Arrays.asList(p.getGroups());
    }
View Full Code Here

    public List<String> getPermGroupNamesForWorld(String world) {
        if (!(permissionsAvailable())) {
            return new ArrayList<String>(0);
        }
        ServicesManager sm = Bukkit.getServicesManager();
        Permission p = sm.getRegistration(Permission.class).getProvider();
        return Arrays.asList(p.getGroups());
    }
View Full Code Here

    public List<String> getPermGroupUsers(String groupName) {
        if (!(permissionsAvailable())) {
            return new ArrayList<String>(0);
        }
        ServicesManager sm = Bukkit.getServicesManager();
        Permission p = sm.getRegistration(Permission.class).getProvider();
        List<String> result = new ArrayList<String>();
        for (Player player : Bukkit.getOnlinePlayers()) {
            if (p.playerInGroup(player, groupName)) {
                result.add(player.getName());
            }
        }
        return result;
    }
View Full Code Here

    public List<String> getPermGroupUsersForWorld(String groupName, String worldName) {
        if (!(permissionsAvailable())) {
            return new ArrayList<String>(0);
        }
        ServicesManager sm = Bukkit.getServicesManager();
        Permission p = sm.getRegistration(Permission.class).getProvider();
        List<String> result = new ArrayList<String>();
        for (Player player : Bukkit.getOnlinePlayers()) {
            String playerName = player.getName();
            if (p.playerInGroup(worldName, playerName, groupName)) {
                result.add(playerName);
            }
        }
        return result;
    }
View Full Code Here

    public List<String> getGroupPerms(String groupName) {
        if (!(permissionsAvailable())) {
            return new ArrayList<String>(0);
        }
        ServicesManager sm = Bukkit.getServicesManager();
        Permission p = sm.getRegistration(Permission.class).getProvider();
        List<String> result = new ArrayList<String>();
        for (org.bukkit.permissions.Permission perm : Bukkit.getPluginManager().getPermissions()) {
            String permName = perm.getName();
            if (p.groupHas(Bukkit.getWorlds().get(0), groupName, permName)) {
                result.add(permName);
            }
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of net.milkbowl.vault.permission.Permission

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.