예제 #1
0
파일: Group.cs 프로젝트: blha303/MCDawn
        public void fillCommands()
        {
            CommandList _commands = new CommandList();

            GrpCommands.AddCommands(out _commands, Permission);
            commands = _commands;
        }
예제 #2
0
        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));
        }
예제 #3
0
        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.");
        }
예제 #4
0
        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.");
        }