private void onCmdGroup(IServerPlayer player, int groupId, CmdArgs args) { string privtype = args.PopWord(); string firstarg = args.PopWord(); string flagString = args.PopWord(); if (privtype == null) { player.SendMessage(groupId, "Syntax: /gbre [grant|revoke|grantgroup|revokegroup] default or [playername/groupname] [use or all]", EnumChatType.CommandError); return; } EnumBlockAccessFlags flags; if (flagString?.ToLowerInvariant() == "use") { flags = EnumBlockAccessFlags.Use; } else if (flagString?.ToLowerInvariant() == "all") { flags = EnumBlockAccessFlags.BuildOrBreak | EnumBlockAccessFlags.Use; } else { if (privtype == "grant") { player.SendMessage(groupId, "Missing argument or argument is not 'use' or 'all'", EnumChatType.CommandError); } return; } var group = player.GetGroup(groupId); if (group == null) { player.SendMessage(groupId, "Type this command inside the group chat tab that you are a owner of", EnumChatType.CommandError); return; } if (group.Level != EnumPlayerGroupMemberShip.Owner) { player.SendMessage(groupId, "Must be owner of the group to change access flags", EnumChatType.CommandError); return; } ReinforcedPrivilegeGrantsGroup groupGrants; if (!privGrantsByOwningGroupUid.TryGetValue(groupId, out groupGrants)) { privGrantsByOwningGroupUid[groupId] = groupGrants = new ReinforcedPrivilegeGrantsGroup(); } if (firstarg == "default") { if (privtype == "grant") { groupGrants.DefaultGrants = flags; player.SendMessage(groupId, "Default access for group members set to " + flagString, EnumChatType.CommandError); } else { groupGrants.DefaultGrants = 0; player.SendMessage(groupId, "All access revoked for group members", EnumChatType.CommandError); } SyncPrivData(); return; } if (privtype == "grant" || privtype == "revoke") { grantRevokeGroupOwned2Player(player, groupId, privtype, firstarg, flagString, flags, groupGrants); return; } if (privtype == "grantgroup" || privtype == "revokegroup") { grantRevokeGroupOwned2Group(player, groupId, privtype, firstarg, flags); return; } player.SendMessage(groupId, "Syntax: /gbre [grant|revoke|grantgroup|revokegroup] members or [playername/groupname] [use or all]", EnumChatType.CommandError); return; }