Package net.canarymod.user

Examples of net.canarymod.user.Group


                GroupDataAccess data = (GroupDataAccess) da;

                if (alreadyInList(data.name, groups)) {
                    continue;
                }
                Group g = new Group();

                g.setDefaultGroup(data.isDefault);
                g.setId(data.id);
                g.setName(data.name);
                g.setWorldName(ToolBox.stringToNull(data.worldName));
                if (!data.isDefault || !data.name.equals(data.parent)) {
                    g.setParent(loadParents(data.parent, groups));
                }
                g.setPrefix(data.prefix);
                groups.add(g);
            }
        }
        catch (DatabaseReadException e) {
            Canary.logStacktrace(e.getMessage(), e);
View Full Code Here


        }
        catch (DatabaseReadException e) {
            Canary.logStacktrace(e.getMessage(), e);
        }
        if (data.hasData()) {
            Group g = new Group();

            g.setDefaultGroup(data.isDefault);
            g.setId(data.id);
            g.setName(data.name);
            g.setWorldName(ToolBox.stringToNull(data.worldName));
            g.setParent(loadParents(data.parent, existingGroups));
            g.setPrefix(data.prefix);
            return g;
        }
        return null;
    }
View Full Code Here

     */
    public boolean isGroupAllowed(String group) {
        if (allowedGroups == null) {
            return true;
        }
        Group realGroup = Canary.usersAndGroups().getGroup(group);

        if (realGroup == null) {
            return false;
        }
        for (Group g : allowedGroups) {
            if (g.getName().equals(realGroup.getName()) || realGroup.hasControlOver(g)) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

        if (args[args.length - 1].equals("--help")) {
            Canary.help().getHelp(caller, "playermod group remove");
            return;
        }
        Player target = Canary.getServer().matchPlayer(args[1]);
        Group group = Canary.usersAndGroups().getGroup(args[2]);
        if (group == null) {
            caller.notice(Translator.translateAndFormat("unknown group", args[2]));
            return;
        }
        if (target == null) {
View Full Code Here

    public void execute(MessageReceiver caller, String[] args) {
        if (args[args.length - 1].equals("--help")) {
            Canary.help().getHelp(caller, "playermod add");
            return;
        }
        Group g = Canary.usersAndGroups().getGroup(args[2]);
        Player target = Canary.getServer().matchPlayer(args[1]);
        if (g == null) {
            caller.notice(Translator.translateAndFormat("unknown group", args[2]));
            return;
        }

        if (target == null) {
            Canary.usersAndGroups().addOfflinePlayer(args[1], g.getName());
            caller.message(Colors.YELLOW + Translator.translate("modify group set"));
            return;
        }
        target.setGroup(g);
        caller.message(Colors.YELLOW + Translator.translate("modify group set"));
View Full Code Here

        if (args[args.length - 1].equals("--help")) {
            Canary.help().getHelp(caller, "playermod group add");
            return;
        }
        Player target = Canary.getServer().matchPlayer(args[1]);
        Group group = Canary.usersAndGroups().getGroup(args[2]);
        if (group == null) {
            caller.notice(Translator.translateAndFormat("unknown group", args[2]));
            return;
        }
        if (target == null) {
View Full Code Here

        if (args[args.length - 1].equals("--help")) {
            Canary.help().getHelp(caller, "playermod group set");
            return;
        }
        Player target = Canary.getServer().matchPlayer(args[1]);
        Group group = Canary.usersAndGroups().getGroup(args[2]);
        if (group == null) {
            caller.notice(Translator.translateAndFormat("unknown group", args[2]));
            return;
        }
        if (target == null) {
View Full Code Here

        if (args[args.length - 1].equals("--help")) {
            Canary.help().getHelp(caller, "groupmod add");
            return;
        }
        String worldName = null;
        Group parent = null;
        Group group = new Group();

        if (args.length == 4) { // Here we have world and group name
            // we have world and parent set!
            // We require this to get the real fqname of the world,
            // since a user could pass only the world group name which parseWorld
            // will evaluate as the NORMAL dimension.
            World world = ToolBox.parseWorld(args[3]);
            if (world == null) { // Whoops!
                caller.notice(Translator.translateAndFormat("group unknown world", args[3]));
                return;
            }
            worldName = world.getFqName();

            parent = Canary.usersAndGroups().getGroup(args[2]);
            if (parent == null) {
                caller.notice(Translator.translateAndFormat("group unknown parent", args[2]));
                return;
            }
            if (!parent.getWorldName().equals(worldName)) {
                caller.notice(Translator.translateAndFormat("group parent world mismatch", parent.getName(), parent.getWorldName(), worldName));
                return;
            }
        }
        if (args.length == 3) { // This can be only a world or a group name
            parent = Canary.usersAndGroups().getGroup(args[2]);
            if (parent == null) {
                caller.notice(Translator.translateAndFormat("group unknown parent", args[2]));
                return;
            }
            World world = ToolBox.parseWorld(args[2]);
            if (world == null) {
                caller.notice(Translator.translateAndFormat("group unknown world", args[3]));
                return;
            }
            else {
                worldName = world.getFqName();
            }
            String groupworld = parent.getWorldName();
            if (worldName != null && !(groupworld != null && groupworld.equals(worldName))) {
                //Cannot add a parent from another world
                caller.notice(Translator.translateAndFormat("group parent world mismatch", parent.getName(), parent.getWorldName(), worldName));
                return;
            }
        }

        group.setName(args[1]);
        group.setPermissionProvider(Canary.permissionManager().getGroupsProvider(args[1], worldName));
        group.setParent(parent);
        Canary.usersAndGroups().addGroup(group);
        caller.message(Colors.YELLOW + Translator.translateAndFormat("group created", group.getName()));
    }
View Full Code Here

    public void execute(MessageReceiver caller, String[] args) {
        if (args[args.length - 1].equals("--help")) {
            Canary.help().getHelp(caller, "group rename");
            return;
        }
        Group group = Canary.usersAndGroups().getGroup(args[1]);
        if (group == null) {
            caller.notice(Translator.translateAndFormat("group unknown", args[1]));
            return;
        }
        Canary.usersAndGroups().renameGroup(group, args[2]);
        caller.message(Colors.YELLOW + Translator.translateAndFormat("group rename", group.getName()));
    }
View Full Code Here

* @author Chris (damagefilter)
*/
public class GroupPermissionCheck implements NativeCommand {
    // groupmod permission check group value
    public void execute(MessageReceiver caller, String[] args) {
        Group group = Canary.usersAndGroups().getGroup(args[1]);
        if (group == null) {
            caller.notice(Translator.translateAndFormat("unknown group", args[1]));
            return;
        }
        PermissionNode node = PermissionNode.fromString(args[2]);
        if (group.getPermissionProvider().pathExists(node.getName())) {
            if (group.hasPermission(node.getName())) {
                caller.message(Colors.LIGHT_GREEN + node.getName() + ": true");
            }
            else {
                caller.message(Colors.LIGHT_RED + node.getName() + ": false");
            }
        }
        else {
            if (group.hasPermission(node.getName())) {
                caller.message(Colors.LIGHT_GREEN + node.getName() + ": true");
            }
            else {
                caller.message(Colors.YELLOW + node.getName() + ": " + Translator.translate("no"));
            }
View Full Code Here

TOP

Related Classes of net.canarymod.user.Group

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.