public override void Use(Player p, string message) { if (message == "" || message.IndexOf(' ') == -1) { Help(p); return; } string foundBlah = Command.all.FindShort(message.Split(' ')[0]); Command foundCmd; if (foundBlah == "") { foundCmd = Command.all.Find(message.Split(' ')[0]); } else { foundCmd = Command.all.Find(foundBlah); } if (foundCmd == null) { Player.SendMessage(p, "Could not find command entered"); return; } if (p != null && !p.group.CanExecute(foundCmd)) { Player.SendMessage(p, "This command is higher than your rank."); return; } LevelPermission newPerm = Level.PermissionFromName(message.Split(' ')[1]); if (newPerm == LevelPermission.Null) { Player.SendMessage(p, "Could not find rank specified"); return; } if (p != null && newPerm > p.group.Permission) { Player.SendMessage(p, "Cannot set to a rank higher than yourself."); return; } GrpCommands.rankAllowance newCmd = GrpCommands.allowedCommands.Find(rA => rA.commandName == foundCmd.name); newCmd.lowestRank = newPerm; GrpCommands.allowedCommands[GrpCommands.allowedCommands.FindIndex(rA => rA.commandName == foundCmd.name)] = newCmd; GrpCommands.Save(GrpCommands.allowedCommands); GrpCommands.fillRanks(); Player.GlobalMessage("&d" + foundCmd.name + Server.DefaultColor + "'s permission was changed to " + Level.PermissionToName(newPerm)); //if (p == null) ; // this is useless? //{ Player.SendMessage(p, foundCmd.name + "'s permission was changed to " + Level.PermissionToName(newPerm)); return; //} }
private void listCommands_SelectedIndexChanged(object sender, EventArgs e) { Command cmd = Command.all.Find(listCommands.SelectedItem.ToString()); GrpCommands.rankAllowance allowVar = storedCommands.Find(aV => aV.commandName == cmd.name); if (Group.findPerm(allowVar.lowestRank) == null) { allowVar.lowestRank = cmd.defaultRank; } txtCmdLowest.Text = (int)allowVar.lowestRank + ""; }
private void listCommands_SelectedIndexChanged(object sender, EventArgs e) { Command cmd = Command.all.Find(listCommands.SelectedItem.ToString()); GrpCommands.rankAllowance allowVar = storedCommands.Find(aV => aV.commandName == cmd.name); if (Group.findPerm(allowVar.lowestRank) == null) { allowVar.lowestRank = cmd.defaultRank; } txtCmdLowest.Text = (int)allowVar.lowestRank + ""; bool foundOne = false; txtCmdDisallow.Text = ""; foreach (LevelPermission perm in allowVar.disallow) { foundOne = true; txtCmdDisallow.Text += "," + (int)perm; } if (foundOne) { txtCmdDisallow.Text = txtCmdDisallow.Text.Remove(0, 1); } foundOne = false; txtCmdAllow.Text = ""; foreach (LevelPermission perm in allowVar.allow) { foundOne = true; txtCmdAllow.Text += "," + (int)perm; } if (foundOne) { txtCmdAllow.Text = txtCmdAllow.Text.Remove(0, 1); } }