public void fillCommands() { CommandList _commands = new CommandList(); GrpCommands.AddCommands(out _commands, Permission); commands = _commands; }
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 + "&g's permission was changed to " + Level.PermissionToName(newPerm)); Server.s.Log(foundCmd.name + "'s permission was changed to " + Level.PermissionToName(newPerm)); }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } if (Command.all.Contains(message.Split(' ')[0])) { Player.SendMessage(p, "That command is already loaded!"); return; } message = "Cmd" + message.Split(' ')[0];; string error = Scripting.Load(message); if (error != null) { Player.SendMessage(p, error); return; } GrpCommands.fillRanks(); Player.SendMessage(p, "Command was successfully loaded."); }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } if (Command.core.Contains(message.Split(' ')[0])) { Player.SendMessage(p, "/" + message.Split(' ')[0] + " is a core command, you cannot unload it!"); return; } Command foundCmd = Command.all.Find(message.Split(' ')[0]); if (foundCmd == null) { Player.SendMessage(p, message.Split(' ')[0] + " is not a valid or loaded command."); return; } Command.all.Remove(foundCmd); GrpCommands.fillRanks(); Player.SendMessage(p, "Command was successfully unloaded."); }