Package net.canarymod.commandsys.commands.group

Source Code of net.canarymod.commandsys.commands.group.GroupPermissionAdd

package net.canarymod.commandsys.commands.group;

import net.canarymod.Canary;
import net.canarymod.Translator;
import net.canarymod.chat.Colors;
import net.canarymod.chat.MessageReceiver;
import net.canarymod.commandsys.NativeCommand;
import net.canarymod.permissionsystem.PermissionNode;
import net.canarymod.user.Group;

/**
* Command to add a permission to a group  
*
* @author Chris (damagefilter)
*/
public class GroupPermissionAdd implements NativeCommand {
    // groupmod permission add 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]);
        group.getPermissionProvider().addPermission(node.getName(), node.getValue());
        caller.message(Colors.YELLOW + Translator.translate("modify permission added"));
    }
}
TOP

Related Classes of net.canarymod.commandsys.commands.group.GroupPermissionAdd

TOP
Copyright © 2018 www.massapi.com. 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.