static void FixupOldPerms() { var perms = SrvProperties.oldPerms; Server.opchatperm = CommandOtherPerms.FindPerm("opchat", LevelPermission.Operator); Server.adminchatperm = CommandOtherPerms.FindPerm("adminchat", LevelPermission.Admin); if (perms.clearPerm == -1 && perms.nextPerm == -1 && perms.viewPerm == -1 && perms.opchatPerm == -1 && perms.adminchatPerm == -1) { return; } // Backwards compatibility with old config, where some permissions were global if (perms.viewPerm != -1) { CommandOtherPerms.Find("review", 1).Permission = perms.viewPerm; } if (perms.nextPerm != -1) { CommandOtherPerms.Find("review", 2).Permission = perms.nextPerm; } if (perms.clearPerm != -1) { CommandOtherPerms.Find("review", 3).Permission = perms.clearPerm; } if (perms.opchatPerm != -1) { CommandOtherPerms.Find("opchat").Permission = perms.opchatPerm; } if (perms.adminchatPerm != -1) { CommandOtherPerms.Find("adminchat").Permission = perms.adminchatPerm; } CommandOtherPerms.Save(); }
public static void PrintCommandInfo(Player p, Command cmd) { var perms = GrpCommands.allowedCommands.Find(C => C.commandName == cmd.name); StringBuilder builder = new StringBuilder(); builder.Append("Usable by: "); if (perms == null) { builder.Append(Group.GetColoredName(cmd.defaultRank) + "%S+"); } else { PrintRanks(perms.lowestRank, perms.allow, perms.disallow, builder); } Player.Message(p, builder.ToString()); PrintAliases(p, cmd); CommandPerm[] addPerms = cmd.ExtraPerms; if (addPerms == null) { return; } Player.Message(p, "%TExtra permissions:"); for (int i = 0; i < addPerms.Length; i++) { var extra = CommandOtherPerms.Find(cmd, i + 1); LevelPermission perm = (LevelPermission)extra.Permission; Player.Message(p, "{0}) {1}%S{2}", i + 1, Group.GetColoredName(perm), extra.Description); } }