Beispiel #1
0
 static void UpdateGlobal(Player p) {
     Player[] players = PlayerInfo.Online.Items;
     foreach (Player pl in players) {
         pl.SendCurrentTextures();
     }
     SrvProperties.Save();
 }
Beispiel #2
0
 public override void Use(Player p, string message)
 {
     if (message == "" && Server.updateTimer.Interval > 1000)
     {
         Server.PositionInterval = 100;
         Chat.MessageAll("&dLow lag %Sturned &cOFF %S- positions update every &b100 %Sms.");
     }
     else if (message == "")
     {
         Server.PositionInterval = 2000;
         Chat.MessageAll("&dLow lag %Sturned &aON %S- positions update every &b2000 %Sms.");
     }
     else
     {
         int interval;
         if (!int.TryParse(message, out interval))
         {
             Player.Message(p, "Interval given must be an integer."); return;
         }
         if (interval < 20 || interval > 2000)
         {
             Player.Message(p, "Interval must be between 20 and 2000 milliseconds."); return;
         }
         Server.PositionInterval = interval;
         Chat.MessageAll("Positions now update every &b{0} %Smilliseconds.", interval);
     }
     Server.updateTimer.Interval = Server.PositionInterval;
     SrvProperties.Save();
 }
Beispiel #3
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length == 0 && Server.Config.PositionUpdateInterval > 1000)
            {
                Server.Config.PositionUpdateInterval = 100;
                Chat.MessageAll("&dLow lag %Sturned &cOFF %S- positions update every &b100 %Sms.");
            }
            else if (message.Length == 0)
            {
                Server.Config.PositionUpdateInterval = 2000;
                Chat.MessageAll("&dLow lag %Sturned &aON %S- positions update every &b2000 %Sms.");
            }
            else
            {
                int interval = 0;
                if (!CommandParser.GetInt(p, message, "Interval", ref interval, 20, 2000))
                {
                    return;
                }

                Server.Config.PositionUpdateInterval = interval;
                Chat.MessageAll("Positions now update every &b" + interval + " %Smilliseconds.");
            }
            SrvProperties.Save();
        }
Beispiel #4
0
 void SetPrivate(Player p, string[] args)
 {
     Server.Config.Public = false;
     p.Message("Server is now private!");
     Logger.Log(LogType.SystemActivity, "Server is now private!");
     SrvProperties.Save();
 }
Beispiel #5
0
        static void SetMode(bool enabled, string desc)
        {
            Server.Config.WhitelistedOnly = enabled;
            SrvProperties.Save();

            Chat.MessageAll("Whitelisted only mode " + desc);
            Logger.Log(LogType.SystemActivity, "Whitelisted only mode is now " + desc);
        }
Beispiel #6
0
 void LoadProperties()
 {
     SrvProperties.Load();
     LoadGeneralProps();
     LoadChatProps();
     LoadIrcSqlProps();
     LoadMiscProps();
     LoadRankProps();
     LoadSecurityProps();
     zsSettings.LoadFromServer();
 }
Beispiel #7
0
 void UpdateGlobally(Player p, bool zip)
 {
     Player[] players = PlayerInfo.Online.Items;
     foreach (Player pl in players)
     {
         string url = zip ? pl.level.texturePackUrl : pl.level.terrainUrl;
         if (url == "")
         {
             pl.SendCurrentMapAppearance();
         }
     }
     SrvProperties.Save();
 }
Beispiel #8
0
 static void SetLimit(Player p, string type, ref int target, int value, bool hasValue)
 {
     if (!hasValue)
     {
         p.Message(type + ": &b" + target);
     }
     else
     {
         target = value;
         Chat.MessageAll(type + " set to &b" + target);
         SrvProperties.Save();
     }
 }
Beispiel #9
0
 void UpdateGlobally(Player p, bool zip)
 {
     Player[] players = PlayerInfo.Online.Items;
     foreach (Player pl in players)
     {
         string url = zip ? pl.level.Config.TexturePack : pl.level.Config.Terrain;
         if (url.Length == 0)
         {
             pl.SendCurrentMapAppearance();
         }
     }
     SrvProperties.Save();
 }
Beispiel #10
0
        void SaveChanges()
        {
            SaveProperties();
            SaveRanks();
            SaveCommands();
            SaveBlocks();
            SaveGameProps();

            try { ZSGame.Config.Save(); }
            catch { Logger.Log(LogType.Warning, "Error saving Zombie Survival settings!"); }

            SrvProperties.Load(); // loads when saving?
            CommandPerms.Load();
        }
Beispiel #11
0
 void UpdateGlobally(Player p, bool zip)
 {
     Player[] players = PlayerInfo.Online.Items;
     foreach (Player pl in players)
     {
         bool   hasExt = pl.HasCpeExt(CpeExt.EnvMapAppearance) || pl.HasCpeExt(CpeExt.EnvMapAppearance, 2);
         string url    = zip ? pl.level.texturePackUrl : pl.level.terrainUrl;
         if (hasExt && url == "")
         {
             pl.SendCurrentMapAppearance();
         }
     }
     SrvProperties.Save();
 }
Beispiel #12
0
        public static void LoadAllSettings()
        {
            SrvProperties.Load("properties/server.properties");

            /*Updater.Load("properties/update.properties");
             * Group.InitAll();
             * Command.InitAll();
             * GrpCommands.fillRanks();
             * Block.SetBlocks();
             * Awards.Load();
             * Economy.Load();
             * Warp.LOAD();
             * CommandOtherPerms.Load();
             * ProfanityFilter.Init();*/
        }
Beispiel #13
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length == 0)
            {
                if (p.IsSuper)
                {
                    p.Message("Main level is {0}", Server.mainLevel.ColoredName);
                }
                else if (p.level == Server.mainLevel)
                {
                    PlayerActions.Respawn(p);
                }
                else
                {
                    PlayerActions.ChangeMap(p, Server.mainLevel);
                }
            }
            else
            {
                if (!CheckExtraPerm(p, data, 1))
                {
                    return;
                }
                if (!Formatter.ValidName(p, message, "level"))
                {
                    return;
                }
                if (!LevelInfo.Check(p, data.Rank, Server.mainLevel, "set main to another map"))
                {
                    return;
                }

                string map = Matcher.FindMaps(p, message);
                if (map == null)
                {
                    return;
                }
                if (!LevelInfo.Check(p, data.Rank, map, "set main to this map"))
                {
                    return;
                }

                Server.SetMainLevel(map);
                SrvProperties.Save();
                p.Message("Set main level to {0}", Server.mainLevel.ColoredName);
            }
        }
        internal static bool Handle(Player p, Level lvl, string type, string value, EnvConfig cfg, string area)
        {
            if (type.CaselessEq("preset"))
            {
                EnvPreset preset = FindPreset(value);
                if (preset == null)
                {
                    MessagePresets(p); return(false);
                }

                cfg.SkyColor    = preset.Sky;
                cfg.CloudColor  = preset.Clouds;
                cfg.FogColor    = preset.Fog;
                cfg.ShadowColor = preset.Shadow;
                cfg.LightColor  = preset.Sun;
            }
            else if (type.CaselessEq("normal"))
            {
                cfg.ResetEnv();
                p.Message("Reset environment for {0} %Sto normal", area);
            }
            else
            {
                EnvOption opt = EnvOptions.Find(type);
                if (opt == null)
                {
                    return(false);
                }
                opt.SetFunc(p, area, cfg, value);
            }

            if (lvl == null)
            {
                Player[] players = PlayerInfo.Online.Items;
                foreach (Player pl in players)
                {
                    pl.SendCurrentEnv();
                }
                SrvProperties.Save();
            }
            else
            {
                SendEnv(lvl);
                lvl.SaveSettings();
            }
            return(true);
        }
Beispiel #15
0
        public override void Use(Player p, string message)
        {
            if (message.Length == 0)
            {
                if (Player.IsSuper(p))
                {
                    Player.Message(p, "Main level is {0}", Server.mainLevel.ColoredName);
                }
                else if (p.level == Server.mainLevel)
                {
                    Command.all.FindByName("Spawn").Use(p, "");
                }
                else
                {
                    PlayerActions.ChangeMap(p, Server.mainLevel);
                }
            }
            else
            {
                if (!CheckExtraPerm(p, 1))
                {
                    return;
                }
                if (!Formatter.ValidName(p, message, "level"))
                {
                    return;
                }
                if (!LevelInfo.ValidateAction(p, ServerConfig.MainLevel, "set main to another level"))
                {
                    return;
                }

                string map = Matcher.FindMaps(p, message);
                if (map == null)
                {
                    return;
                }
                if (!LevelInfo.ValidateAction(p, map, "set main to this level"))
                {
                    return;
                }

                Server.SetMainLevel(map);
                SrvProperties.Save();
                Player.Message(p, "Set main level to {0}", Server.mainLevel.ColoredName);
            }
        }
Beispiel #16
0
        static void HandleMaxMove(Player p, string message, string[] args)
        {
            byte distance;

            if (args.Length == 1)
            {
                Player.SendMessage(p, "Maxmium move distance is currently &a" + ZombieGame.MaxMoveDistance + " %Sunits apart.");
            }
            else if (!byte.TryParse(args[1], out distance))
            {
                Player.SendMessage(p, "Maximum move distance must be an integer between 0 and 256.");
            }
            else
            {
                ZombieGame.MaxMoveDistance = distance;
                Player.SendMessage(p, "Maximum move distance set to &a" + distance + " %Sunits apart.");
                SrvProperties.Save();
            }
        }
Beispiel #17
0
        static void HandleHitbox(Player p, string message, string[] args)
        {
            byte precision;

            if (args.Length == 1)
            {
                Player.SendMessage(p, "Hitbox detection is currently &a" + ZombieGame.HitboxPrecision + " %Sunits apart.");
            }
            else if (!byte.TryParse(args[1], out precision))
            {
                Player.SendMessage(p, "Hitbox detection must be an integer between 0 and 256.");
            }
            else
            {
                ZombieGame.HitboxPrecision = precision;
                Player.SendMessage(p, "Hitbox detection set to &a" + precision + " %Sunits apart.");
                SrvProperties.Save();
            }
        }
Beispiel #18
0
        void SaveProperties()
        {
            try {
                ApplyGeneralProps();
                ApplyChatProps();
                ApplyIrcSqlProps();
                ApplyEcoProps();
                ApplyMiscProps();
                ApplyRankProps();
                ApplySecurityProps();
                zsSettings.ApplyToServer();

                SrvProperties.Save();
                Economy.Save();
            } catch (Exception ex) {
                Logger.LogError(ex);
                Logger.Log(LogType.Warning, "SAVE FAILED! properties/server.properties");
            }
        }
Beispiel #19
0
        static void SetLimitPercent(Player p, ref float target, float value, bool hasValue)
        {
            const string type = "Threshold before drawing reloads map";

            if (hasValue)
            {
                target = value / 100.0f;
            }
            string percent = (target * 100).ToString("F2") + "%";

            if (!hasValue)
            {
                p.Message(type + ": &b" + percent);
            }
            else
            {
                Chat.MessageAll(type + " set to &b" + percent);
                SrvProperties.Save();
            }
        }
Beispiel #20
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                if (Player.IsSuper(p))
                {
                    Player.Message(p, "Main level is {0}", Server.mainLevel.ColoredName);
                }
                else if (p.level.name == Server.mainLevel.name)
                {
                    Player.Message(p, "You are already on the server's main level.");
                }
                else
                {
                    PlayerActions.ChangeMap(p, Server.mainLevel);
                }
            }
            else
            {
                if (!CheckExtraPerm(p))
                {
                    MessageNeedExtra(p, "change the main level"); return;
                }
                if (!Formatter.ValidName(p, message, "level"))
                {
                    return;
                }

                string map = LevelInfo.FindMapMatches(p, message);
                if (map == null)
                {
                    return;
                }
                Server.SetMainLevel(map);
                SrvProperties.Save();
                Player.Message(p, "Set main level to {0}", Server.mainLevel.ColoredName);
            }
        }
Beispiel #21
0
        public override void Use(Player p, string message)
        {
            string[] args = message.Split(' ');
            if (args.Length < 2)
            {
                Help(p); return;
            }
            int limit;

            if (!int.TryParse(args[1], out limit) || limit <= 0)
            {
                Player.SendMessage(p, "Limit amount must be a whole number and greater than 0."); return;
            }

            switch (args[0].ToLower())
            {
            case "rt":
            case "reloadthreshold":
                Player.GlobalMessage("Threshold before drawing reloads map set to &b" + limit);
                Server.DrawReloadLimit = limit;
                SrvProperties.Save(); return;

            case "rp":
            case "restartphysics":
                Player.GlobalMessage("Custom /rp's limit was changed to &b" + limit);
                Server.rpLimit = limit;
                SrvProperties.Save(); return;

            case "rpnormal":
                Player.GlobalMessage("Normal /rp's limit set to &b" + limit);
                Server.rpNormLimit = limit;
                SrvProperties.Save(); return;

            case "pu":
            case "physicsundo":
                Player.GlobalMessage("Physics undo max entries set to &b" + limit);
                Server.physUndo = limit;
                SrvProperties.Save(); return;

            case "gen":
            case "genlimit":
                Player.GlobalMessage("Maximum volume of maps players can generate set to &b" + limit);
                Server.MapGenLimit = limit;
                SrvProperties.Save(); return;

            case "genadmin":
            case "genadminlimit":
            case "admingen":
            case "admingenlimit":
                Player.GlobalMessage("Maximum volume of maps admins can generate set to &b" + limit);
                Server.MapGenLimitAdmin = limit;
                SrvProperties.Save(); return;
            }

            if (args.Length == 2)
            {
                Player.SendMessage(p, "You need to provide a rank name for this type."); return;
            }
            Group grp = Group.Find(args[2]);

            if (grp == null)
            {
                Player.SendMessage(p, "No rank found matching: " + args[2]); return;
            }

            switch (args[0].ToLower())
            {
            case "dl":
            case "drawlimit":
                Player.GlobalMessage(grp.color + grp.name + "%S's draw limit set to &b" + limit);
                grp.maxBlocks = limit; break;

            case "mu":
            case "maxundo":
                Player.GlobalMessage(grp.color + grp.name + "%S's undo limit set to &b" + limit);
                grp.maxUndo = limit; break;

            default:
                Help(p); return;
            }
            Group.saveGroups(Group.GroupList);
        }
Beispiel #22
0
        private void HandleMobileSettingsChange(byte[] message)
        {
            const string KEY_SERVER_NAME      = "servername:= ";
            const string KEY_SERVER_MOTD      = "servermotd:= ";
            const string KEY_SERVER_PORT      = "serverport:= ";
            const string KEY_SERVER_IS_PUBLIC = "serverpublic:= ";
            const string KEY_MAIN_NAME        = "servermapname:= ";
            const string KEY_ADMINS_JOIN      = "serveradminjoin:= ";

            const string KEY_IRC_USE       = "ircuse:= ";
            const string KEY_IRC_SERVER    = "ircserver:= ";
            const string KEY_IRC_CHANNEL   = "ircchannel:= ";
            const string KEY_IRC_OPCHANNEL = "ircopchannel:= ";
            const string KEY_IRC_NICK      = "ircnick:= ";
            const string KEY_IRC_COLOR     = "irccolor:= ";
            const string KEY_IRC_IDENT     = "ircident:= ";
            const string KEY_IRC_PASS      = "******";
            const string KEY_IRC_PORT      = "ircport:= ";

            const string KEY_MISC_PHYSICSRESTART = "miscphysicssp:= ";
            const string KEY_MISC_RPLIMIT        = "miscrplimit:= ";
            const string KEY_MISC_NORMRPLIMIT    = "miscnormalrplimit:= ";
            const string KEY_MISC_GLOBALCHAT     = "miscglobalchat:= ";
            const string KEY_MISC_GLOBALCOLOR    = "miscglobalcolor:= ";
            const string KEY_MISC_GLOBALNAME     = "miscglobalnick:= ";
            const string KEY_MISC_DOLLAR         = "miscdollar:= ";
            const string KEY_MISC_SUPEROPRANK    = "miscsuperop:= ";
            const string KEY_MISC_PARSEEMOTE     = "miscparseemote:= ";

            short  length = util.EndianBitConverter.Big.ToInt16(message, 0);
            string mass   = Encoding.UTF8.GetString(message, 2, length);

            mass = DecryptMobile(mass, _keyMobile);
            try
            {
                if (mass.StartsWith(KEY_SERVER_NAME))
                {
                    mass        = mass.Replace(KEY_SERVER_NAME, "");
                    Server.name = mass;
                    SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_ADMINS_JOIN))
                {
                    mass = mass.Replace(KEY_ADMINS_JOIN, "");
                    Server.adminsjoinsilent = Boolean.Parse(mass); SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_SERVER_MOTD))
                {
                    mass        = mass.Replace(KEY_SERVER_MOTD, "");
                    Server.motd = mass; SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_SERVER_PORT))
                {
                    mass        = mass.Replace(KEY_SERVER_PORT, "");
                    Server.port = int.Parse(mass); SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_SERVER_IS_PUBLIC))
                {
                    mass       = mass.Replace(KEY_SERVER_IS_PUBLIC, "");
                    Server.pub = Boolean.Parse(mass);
                    SrvProperties.Save("properties/server.properties");

                    return;
                }
                if (mass.StartsWith(KEY_MAIN_NAME))
                {
                    mass = mass.Replace(KEY_MAIN_NAME, "");
                    if (Player.ValidName(mass))
                    {
                        Server.level = mass;
                    }
                    SrvProperties.Save("properties/server.properties");
                    return;
                }
                //---------------------------------IRC--------------------------------//
                if (mass.StartsWith(KEY_IRC_USE))
                {
                    mass       = mass.Replace(KEY_IRC_USE, "");
                    Server.irc = Boolean.Parse(mass); SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_IRC_SERVER))
                {
                    mass             = mass.Replace(KEY_IRC_SERVER, "");
                    Server.ircServer = mass; SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_IRC_CHANNEL))
                {
                    mass = mass.Replace(KEY_IRC_CHANNEL, "");
                    Server.ircChannel = mass; SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_IRC_OPCHANNEL))
                {
                    mass = mass.Replace(KEY_IRC_OPCHANNEL, "");
                    Server.ircOpChannel = mass; SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_IRC_NICK))
                {
                    mass           = mass.Replace(KEY_IRC_NICK, "");
                    Server.ircNick = mass; SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_IRC_PORT))
                {
                    mass           = mass.Replace(KEY_IRC_PORT, "");
                    Server.ircPort = int.Parse(mass); SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_IRC_PASS))
                {
                    mass = mass.Replace(KEY_IRC_PASS, "");
                    Server.ircPassword = mass; SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_IRC_COLOR))
                {
                    mass             = mass.Replace(KEY_IRC_COLOR, "");
                    Server.IRCColour = mass; SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_IRC_IDENT))
                {
                    mass = mass.Replace(KEY_IRC_IDENT, "");
                    Server.ircIdentify = Boolean.Parse(mass); SrvProperties.Save("properties/server.properties");
                    return;
                }

                //------------------MISC-----------------------------------------------//
                if (mass.StartsWith(KEY_MISC_PHYSICSRESTART))
                {
                    mass = mass.Replace(KEY_MISC_PHYSICSRESTART, "");
                    Server.physicsRestart = Boolean.Parse(mass); SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_MISC_RPLIMIT))
                {
                    mass           = mass.Replace(KEY_MISC_RPLIMIT, "");
                    Server.rpLimit = int.Parse(mass); SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_MISC_NORMRPLIMIT))
                {
                    mass = mass.Replace(KEY_MISC_NORMRPLIMIT, "");
                    Server.rpNormLimit = int.Parse(mass); SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_MISC_GLOBALCHAT))
                {
                    mass = mass.Replace(KEY_MISC_GLOBALCHAT, "");
                    Server.UseGlobalChat = Boolean.Parse(mass); SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_MISC_GLOBALCOLOR))
                {
                    mass = mass.Replace(KEY_MISC_GLOBALCOLOR, "");
                    Server.GlobalChatColor = mass; SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_MISC_GLOBALNAME))
                {
                    mass = mass.Replace(KEY_MISC_GLOBALNAME, "");
                    Server.GlobalChatNick = mass; SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_MISC_DOLLAR))
                {
                    mass = mass.Replace(KEY_MISC_DOLLAR, "");
                    Server.dollardollardollar = Boolean.Parse(mass); SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_MISC_SUPEROPRANK))
                {
                    mass             = mass.Replace(KEY_MISC_SUPEROPRANK, "");
                    Server.rankSuper = Boolean.Parse(mass); SrvProperties.Save("properties/server.properties");
                    return;
                }
                if (mass.StartsWith(KEY_MISC_PARSEEMOTE))
                {
                    mass = mass.Replace(KEY_MISC_PARSEEMOTE, "");
                    Server.parseSmiley = Boolean.Parse(mass); SrvProperties.Save("properties/server.properties");
                    return;
                }
            }
            catch (FormatException)
            {
                Server.s.Log("Remote sent invalid setting");
            }
        }
Beispiel #23
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length == 0)
            {
                Help(p); return;
            }
            string[] parts = message.SplitSpaces();
            RelayBot bot   = Bot;

            string cmd = parts[0].ToLower();
            string arg = parts.Length > 1 ? parts[1] : "";

            switch (cmd)
            {
            case "reload":
                bot.LoadControllers();
                p.Message("{0} controllers reloaded!", bot.RelayName);
                break;

            case "add":
                if (arg.Length == 0)
                {
                    p.Message("You need to provide a name to add."); return;
                }

                if (!bot.Controllers.Add(arg))
                {
                    p.Message("{0} is already in the {1} controllers list.", arg, bot.RelayName);
                }
                else
                {
                    bot.Controllers.Save();
                    p.Message("{0} added to the {1} controllers list.", arg, bot.RelayName);
                }
                break;

            case "remove":
                if (arg.Length == 0)
                {
                    p.Message("You need to provide a name to remove."); return;
                }

                if (!bot.Controllers.Remove(arg))
                {
                    p.Message("{0} is not in the {1} controllers list.", arg, bot.RelayName);
                }
                else
                {
                    bot.Controllers.Save();
                    p.Message("{0} removed from the {1} controllers list.", arg, bot.RelayName);
                }
                break;

            case "list":
                bot.Controllers.OutputPlain(p, bot.RelayName + " controllers",
                                            name + " list", arg);
                break;

            case "rank":
                if (arg.Length == 0)
                {
                    p.Message("{0} controllers have the rank {1}", bot.RelayName,
                              Group.GetColoredName(Server.Config.IRCControllerRank));
                    return;
                }

                Group grp = Matcher.FindRanks(p, arg);
                if (grp == null)
                {
                    return;
                }
                if (Server.Config.IRCControllerRank > data.Rank)
                {
                    p.Message("Cannot change the {0} controllers rank, " +
                              "as it is currently a rank higher than yours.", bot.RelayName); return;
                }
                if (grp.Permission > data.Rank)
                {
                    p.Message("Cannot set the {0} controllers rank to a rank higher than yours.", bot.RelayName); return;
                }

                Server.Config.IRCControllerRank = grp.Permission;
                SrvProperties.Save();
                p.Message("Set {0} controller rank to {1}&S.", bot.RelayName, grp.ColoredName);
                break;

            default:
                Help(p); break;
            }
        }
Beispiel #24
0
        public static void Main(string[] args)
        {
            /*if (Process.GetProcessesByName("MCForge").Length != 1)
             *          {
             *                  foreach (Process pr in Process.GetProcessesByName("MCForge"))
             *                  {
             *                          if (pr.MainModule.BaseAddress == Process.GetCurrentProcess().MainModule.BaseAddress)
             *                                  if (pr.Id != Process.GetCurrentProcess().Id)
             *                                          pr.Kill();
             *                  }
             *          }*/
            //Get a pointer to the forground window.  The idea here is that
            //IF the user is starting our application from an existing console
            //shell, that shell will be the uppermost window.  We'll get it
            //and attach to it
            IntPtr ptr = GetForegroundWindow();

            int u;

            GetWindowThreadProcessId(ptr, out u);

            Process process = Process.GetProcessById(u);

            if (process.ProcessName == "cmd")     //Is the uppermost window a cmd process?
            {
                AttachConsole(process.Id);

                //we have a console to attach to ..
                Console.WriteLine("hello. It looks like you started me from an existing console.");
            }
            else
            {
                //no console AND we're in console mode ... create a new console.

                AllocConsole();
            }

            //FreeConsole();
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Program.GlobalExHandler);
            Application.ThreadException += new ThreadExceptionEventHandler(Program.ThreadExHandler);
            Dictionary <string, DataTable> ZoneDb = new Dictionary <string, DataTable>();

            try {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("Starting upgrade...");
                Console.WriteLine("Loading old properties...");
                Server.s = new Server();
                Server.LoadAllSettings();
                Console.WriteLine("Converting database...");
            }
            catch (Exception e) { Console.WriteLine(e.ToString()); }
            try {
                //Convert Database for MySQL users
                if (Server.useMySQL)
                {
                    //Create the tables..
                    MySQL.execute("CREATE TABLE if not exists _players (UID INTEGER not null auto_increment, Name VARCHAR(20), IP VARCHAR(20), firstlogin DATETIME, lastlogin DATETIME, money MEDIUMINT, totallogin MEDIUMINT, totalblocks MEDIUMINT, color VARCHAR(5) PRIMARY KEY (UID));");
                    MySQL.execute("CREATE TABLE if not exists extra (key VARCHAR(1000), value VARCHAR(1000), UID INTEGER);");
                    //Lets start with the players
                    DataTable table = new DataTable("table");
                    MySQL.fill("SELECT * FROM Players", table);
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        try {
                            MySQL.execute("INSERT INTO _players (Name, IP, firstlogin, lastlogin, money, totallogin, totalblocks, color) VALUES ('" + table.Rows[i]["Name"].ToString() + "', '" + table.Rows[i]["IP"].ToString() + "', '" + table.Rows[i]["FirstLogin"].ToString() + "', '" + table.Rows[i]["LastLogin"].ToString() + "', " + int.Parse(table.Rows[i]["Money"].ToString()) + ", " + int.Parse(table.Rows[i]["totalLogin"].ToString()) + ", " + int.Parse(table.Rows[i]["totalBlocks"].ToString()) + ", '" + table.Rows[i]["color"].ToString() + "')");
                            //Title and Color are to be treated as an extra item...
                            MySQL.execute("INSERT INTO extra (key, value, UID) VALUES ('Title', '" + table.Rows[i]["Title"].ToString() + "', " + i + ")");
                            //MySQL.execute("INSERT INTO extra (key, value, UID) VALUES ('Color', '" + table.Rows[i]["color"].ToString() + "', " + i + ")");
                        }
                        catch {
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.WriteLine("Converting failed for column " + i);
                        }
                    }
                    //Were done
                    table.Dispose();
                    //DROP THE OLD TABLE!
                    //Maybe ._.
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("Finished converting player table..");

                    Console.WriteLine("Converting Level data..");
                    MySQL.execute("CREATE TABLE if not exists Blocks (UID INTEGER, X MEDIUMINT, Y MEDIUMINT, Z MEDIUMINT, Level VARCHAR(100), Deleted VARCHAR(30), Block TEXT, Date DATETIME, Was TEXT);");
                    foreach (string levelfile in Directory.GetFiles("levels", "*.lvl"))
                    {
                        try {
                            //Get level name
                            FileInfo fi   = new FileInfo(levelfile);
                            string   name = fi.Name.Split('.')[0];
                            try {
                                Console.WriteLine("Getting zones for later use..");
                                DataTable Zones = new DataTable();
                                MySQL.fill("SELECT * FROM `Zone" + name + "`", Zones);
                                ZoneDb.Add(name, Zones);
                            } catch { }
                            DataTable table1 = new DataTable("table1");
                            MySQL.fill("SELECT * FROM Block" + name, table1);
                            DataTable temp = new DataTable("temp");
                            for (int i = 0; i < table1.Rows.Count; i++)
                            {
                                //Convert username to UID
                                MySQL.fill("SELECT * FROM _players WHERE Name='" + table1.Rows[i]["Username"].ToString() + "'", temp);
                                int    UID      = int.Parse(temp.Rows[0]["UID"].ToString());
                                int    x        = int.Parse(table1.Rows[i]["X"].ToString());
                                int    y        = int.Parse(table1.Rows[i]["Y"].ToString());
                                int    z        = int.Parse(table1.Rows[i]["Z"].ToString());
                                string time     = table1.Rows[i]["TimePerformed"].ToString();
                                int    deleted  = int.Parse(table1.Rows[i]["deleted"].ToString());
                                string finaldel = (deleted == 1 ? "true" : "false");
                                MySQL.execute("INSERT INTO Blocks (UID, X, Y, Z, Level, Deleted, Date) VALUES (" + UID + ", " + x + ", " + y + ", " + z + ", '" + name + "', '" + finaldel + "', '" + time + "')");
                            }
                            //TODO Add zones, mb, and portals once those are in
                            //Snowl panned them to be in the Level.ExtraData
                            //(it allows for portability of the .lvl so you can move it from server to server without requiring MySQL)
                        }
                        catch (Exception e) {
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.WriteLine("Converting failed for " + levelfile);
                            Console.WriteLine(e.ToString());
                            Console.ForegroundColor = ConsoleColor.Green;
                        }
                    }
                }
                else
                {
                    try {
                        SQLite.execute("CREATE TABLE if not exists _players (UID INTEGER not null PRIMARY KEY AUTOINCREMENT, Name VARCHAR(20), IP VARCHAR(20), firstlogin DATETIME, lastlogin DATETIME, money MEDIUMINT, totallogin MEDIUMINT, totalblocks MEDIUMINT, color VARCHAR(5));");
                        SQLite.execute("CREATE TABLE if not exists extra (key VARCHAR(1000), value VARCHAR(1000), UID INTEGER);");
                        DataTable table = new DataTable("table");
                        SQLite.fill("SELECT * FROM Players", table);
                        for (int i = 0; i < table.Rows.Count; i++)
                        {
                            SQLite.execute("INSERT INTO _players (Name, IP, firstlogin, lastlogin, money, totallogin, totalblocks, color) VALUES ('" + table.Rows[i]["Name"].ToString() + "', '" + table.Rows[i]["IP"].ToString() + "', '" + table.Rows[i]["FirstLogin"].ToString() + "', '" + table.Rows[i]["LastLogin"].ToString() + "', " + int.Parse(table.Rows[i]["Money"].ToString()) + ", " + int.Parse(table.Rows[i]["totalLogin"].ToString()) + ", " + int.Parse(table.Rows[i]["totalBlocks"].ToString()) + ", '" + table.Rows[i]["color"].ToString() + "')");
                            //Title and Color are to be treated as an extra item...
                            SQLite.execute("INSERT INTO extra (key, value, UID) VALUES ('Title', '" + table.Rows[i]["Title"].ToString() + "', " + i + ")");
                            //SQLite.execute("INSERT INTO extra (key, value, UID) VALUES ('Color', '" + table.Rows[i]["color"].ToString() + "', " + i + ")");
                        }
                        table.Dispose();
                        Console.WriteLine("Finished converting player table..");

                        Console.WriteLine("Converting Level data..");
                        SQLite.execute("CREATE TABLE if not exists Blocks (UID INTEGER, X MEDIUMINT, Y MEDIUMINT, Z MEDIUMINT, Level VARCHAR(100), Deleted VARCHAR(30), Block TEXT, Date DATETIME, Was TEXT);");
                        foreach (string levelfile in Directory.GetFiles("levels", "*.lvl"))
                        {
                            try {
                                //Convert Block History
                                FileInfo fi   = new FileInfo(levelfile);
                                string   name = fi.Name.Split('.')[0];
                                try {
                                    Console.WriteLine("Getting zones for later use..");
                                    DataTable Zones = new DataTable();
                                    SQLite.fill("SELECT * FROM `Zone" + name + "`", Zones);
                                    ZoneDb.Add(name, Zones);
                                } catch { }
                                DataTable table1 = new DataTable("table1");
                                SQLite.fill("SELECT * FROM Block" + name, table1);
                                DataTable temp = new DataTable("temp");
                                for (int i = 0; i < table1.Rows.Count; i++)
                                {
                                    //Convert username to UID
                                    SQLite.fill("SELECT * FROM _players WHERE Name='" + table1.Rows[i]["Username"].ToString() + "'", temp);
                                    int    UID      = int.Parse(temp.Rows[0]["UID"].ToString());
                                    int    x        = int.Parse(table1.Rows[i]["X"].ToString());
                                    int    y        = int.Parse(table1.Rows[i]["Y"].ToString());
                                    int    z        = int.Parse(table1.Rows[i]["Z"].ToString());
                                    string time     = table1.Rows[i]["TimePerformed"].ToString();
                                    int    deleted  = int.Parse(table1.Rows[i]["deleted"].ToString());
                                    string finaldel = (deleted == 1 ? "true" : "false");
                                    SQLite.execute("INSERT INTO Blocks (UID, X, Y, Z, Level, Deleted, Date) VALUES (" + UID + ", " + x + ", " + y + ", " + z + ", '" + name + "', '" + finaldel + "', '" + time + "')");
                                }
                                //TODO Add zones, mb, and portals once those are in
                            }
                            catch (Exception e) {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("Converting failed for " + levelfile);
                                Console.WriteLine(e.ToString());
                                Console.ForegroundColor = ConsoleColor.Green;
                            }
                        }
                    }
                    catch {
                        Console.WriteLine("Error converting database, assuming there is none..");
                    }
                }
                Console.ForegroundColor = ConsoleColor.Green;
                foreach (string level in Directory.GetFiles("levels", "*.lvl"))
                {
                    try {
                        Console.ForegroundColor = ConsoleColor.Green;
                        Level l = Level.LoadLevel(level);
                        if (l != null)
                        {
                            Console.WriteLine("Converting zones for level " + l.Name + "..");
                            Console.WriteLine("Converting " + ZoneDb.Count + " zones!");
                            try {
                                DataTable temp = ZoneDb[l.Name];
                                Zone      Zn;
                                for (int i = 0; i < temp.Rows.Count; ++i)
                                {
                                    Zn.smallX = ushort.Parse(temp.Rows[i]["SmallX"].ToString());
                                    Zn.smallY = ushort.Parse(temp.Rows[i]["SmallY"].ToString());
                                    Zn.smallZ = ushort.Parse(temp.Rows[i]["SmallZ"].ToString());
                                    Zn.bigX   = ushort.Parse(temp.Rows[i]["BigX"].ToString());
                                    Zn.bigY   = ushort.Parse(temp.Rows[i]["BigY"].ToString());
                                    Zn.bigZ   = ushort.Parse(temp.Rows[i]["BigZ"].ToString());
                                    Zn.Owner  = temp.Rows[i]["Owner"].ToString();
                                    Plugins.Zones.Zone z = new Plugins.Zones.Zone(new MCForge.Utils.Vector3D(Zn.smallX, Zn.smallZ, Zn.smallY), new MCForge.Utils.Vector3D(Zn.bigX, Zn.bigZ, Zn.bigY), Zn.Owner, Zn.Owner, 0, l, false);
                                }
                            } catch (Exception e) {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("Error converting zones..");
                                Console.WriteLine(e.ToString());
                                Console.ForegroundColor = ConsoleColor.Green;
                            }
                            if (ZoneDb.ContainsKey(l.Name))
                            {
                                ZoneDb.Remove(l.Name);
                            }
                            l.SaveToBinary();
                            Console.ForegroundColor = ConsoleColor.Green;
                            Console.WriteLine(level + " converted!");
                        }
                        else
                        {
                            Console.ForegroundColor = ConsoleColor.Yellow;
                            Console.WriteLine("Level didnt load, must be a MCForge 6 level..");
                        }
                    }
                    catch (Exception e) {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("Error converting " + level);
                        Console.WriteLine(e.ToString());
                    }
                }
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("Converting Properties..");
                SrvProperties.ConvertSettings();
                Console.WriteLine("Converting Groups..");
                try {
                    Group.InitAll();
                    foreach (Group g in Group.GroupList)
                    {
                        try {
                            PlayerGroup pg = new PlayerGroup((int)g.Permission, g.name, g.color, g.fileName);
                            pg.SaveGroup();
                            Console.WriteLine("Group " + g.name + " converted!");
                            PlayerGroup.Groups.Add(pg);
                        }
                        catch (Exception e) {
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.WriteLine("Error converting the group " + g.name + " !");
                            Console.WriteLine(e.ToString());
                            Console.ForegroundColor = ConsoleColor.Green;
                        }
                    }
                    Console.WriteLine("Saving new Groups..");
                    PlayerGroupProperties.Save();
                    File.Delete("properties/ranks.properties");
                    Console.WriteLine("Converting Command Permissions..");
                    CMDCONVERT.CONVERTCMD();
                }
                catch (Exception e) {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Error converting groups!");
                    Console.WriteLine(e.ToString());
                    Console.ForegroundColor = ConsoleColor.Green;
                }
                Console.WriteLine("Renaming files..");
                File.Move("ranks/uberOps.txt", "ranks/superops.txt");
                File.Move("ranks/operators.txt", "ranks/ops.txt");
                Console.WriteLine("Moving Files..");
                string directory = "MCForge";
                if (!Directory.Exists("MCForge"))
                {
                    Directory.CreateDirectory("MCForge");
                }
                else
                {
                    int i = 0;
                    while (Directory.Exists("MCForge" + i))
                    {
                        i++;
                    }
                    Directory.CreateDirectory("MCForge" + i);
                    directory = "MCForge" + i;
                }
                Console.WriteLine("Moving Properties..");
                try { Directory.Move("properties", directory + "/properties"); } catch (Exception e) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Error moving properties, you might need to do this after the upgrade!"); Console.ForegroundColor = ConsoleColor.Green; }
                try { Console.WriteLine("Moving Levels (This could take a while).."); } catch (Exception e) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Error moving levels, you might need to do this after the upgrade!"); Console.ForegroundColor = ConsoleColor.Green; }
                Directory.Move("levels", directory + "/levels");
                if (!Server.useMySQL)
                {
                    Console.WriteLine("Moving SQLite DB..");
                    try { File.Copy(Server.apppath + "/MCForge.db", directory + "/MCForge.db"); } catch (Exception e) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Error copying database, you might need to do this after the upgrade!"); Console.ForegroundColor = ConsoleColor.Green; }
                }
                Console.WriteLine("Moving ranks..");
                try { Directory.Move("ranks", directory + "/ranks"); } catch (Exception e) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Error moving ranks, you might need to do this after the upgrade!"); Console.ForegroundColor = ConsoleColor.Green; }
                Console.WriteLine("Moving text..");
                try { Directory.Move("text", directory + "/text"); } catch (Exception e) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Error moving text, you might need to do this after the upgrade!"); Console.ForegroundColor = ConsoleColor.Green; }
                Console.WriteLine("Archiving logs..");
                try { Directory.Move("logs", directory + "/old_logs"); } catch (Exception e) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Error archiving logs, you might need to do this after the upgrade!"); Console.ForegroundColor = ConsoleColor.Green; }
                Console.Write("Downloading Core Commands..");
                MCForge.Downloader d = new MCForge.Downloader();
                d.Download("http://update.mcforge.net/DLL/Commands.dll", directory + "/Command.dll");
                d.Wait();
                Console.Write("\nDone!");
                d = new MCForge.Downloader();
                Console.Write("\nDownloading Core Plugins..");
                d.Download("http://update.mcforge.net/DLL/Plugins.dll", directory + "/Plugins.dll");
                d.Wait();
                Console.WriteLine("\nDone!");
                Console.Write("\nDownloading the ");
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write("CORE");
                Console.ForegroundColor = ConsoleColor.Green;
                d = new MCForge.Downloader();
                d.Download("http://update.mcforge.net/DLL/Core.dll", directory + "/MCForge.dll");
                d.Wait();
                Console.Write("\nDone!\n");
                Console.WriteLine("Downloading Dependencies..");
                string[] todl = new string[0];
                using (WebClient wc = new WebClient())
                    todl = wc.DownloadString("http://update.mcforge.net/Dependencies/files.txt").Split(':');
                d = new MCForge.Downloader();
                foreach (string s in todl)
                {
                    Console.Write("\nDownloading " + s + "..");
                    d.Download("http://update.mcforge.net/Dependencies/" + s, directory + "/" + s);
                    d.Wait();
                    d.Reset();
                    Thread.Sleep(2000);
                }
            }
            catch (Exception e) { Console.WriteLine(e.ToString()); Console.ReadKey(true); }
            Console.ReadKey(true);
        }
Beispiel #25
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length == 0)
            {
                Help(p); return;
            }
            string[] parts = message.SplitSpaces();

            switch (parts[0].ToLower())
            {
            case "reload":
                Server.ircControllers = PlayerList.Load("ranks/IRC_Controllers.txt");
                p.Message("IRC Controllers reloaded!");
                break;

            case "add":
                if (parts.Length < 2)
                {
                    p.Message("You need to provide a name to add."); return;
                }

                if (!Server.ircControllers.AddUnique(parts[1]))
                {
                    p.Message(parts[1] + " is already an IRC controller.");
                }
                else
                {
                    Server.ircControllers.Save();
                    p.Message(parts[1] + " added to the IRC controller list.");
                }
                break;

            case "remove":
                if (parts.Length < 2)
                {
                    p.Message("You need to provide a name to remove."); return;
                }

                if (!Server.ircControllers.Remove(parts[1]))
                {
                    p.Message(parts[1] + " is not an IRC controller.");
                }
                else
                {
                    Server.ircControllers.Save();
                    p.Message(parts[1] + " removed from the IRC controller list.");
                }
                break;

            case "list":
                string names = Server.ircControllers.All().Join();
                p.Message("IRC controllers list:");
                p.Message(names);
                break;

            case "rank":
                if (parts.Length < 2)
                {
                    p.Message("IRC controllers have the rank {0}",
                              Group.GetColoredName(Server.Config.IRCControllerRank));
                    return;
                }

                Group grp = Matcher.FindRanks(p, parts[1]);
                if (grp == null)
                {
                    return;
                }
                if (Server.Config.IRCControllerRank > data.Rank)
                {
                    p.Message("Cannot change the IRC controllers rank, as it is currently a rank higher than yours."); return;
                }
                if (grp.Permission > data.Rank)
                {
                    p.Message("Cannot set the IRC controllers rank to a rank higher than yours."); return;
                }

                Server.Config.IRCControllerRank = grp.Permission;
                SrvProperties.Save();
                p.Message("Set IRC controller rank to {0}%S.", grp.ColoredName);
                break;

            default:
                Help(p); break;
            }
        }
Beispiel #26
0
        public override void Use(Player p, string message)
        {
            string xjailMap = ServerConfig.XJailLevel;

            if (xjailMap == "(main)")
            {
                xjailMap = Server.mainLevel.name;
            }
            if (message.Length == 0)
            {
                Help(p); return;
            }

            Command jail = Command.all.FindByName("Jail");

            if (message == "set")
            {
                if (!p.level.IsMuseum)
                {
                    jail.Use(p, "set");
                    ServerConfig.XJailLevel = p.level.name;
                    SrvProperties.Save();
                    Player.Message(p, "The xjail map was set from '" + xjailMap + "' to '" + p.level.name + "'");
                }
                else
                {
                    Player.Message(p, "You are in a museum!");
                }
                return;
            }

            Player who = PlayerInfo.FindMatches(p, message);

            if (who == null)
            {
                return;
            }
            if (p != null && who.Rank >= p.Rank)
            {
                MessageTooHighRank(p, "xjail", false); return;
            }

            Command spawn  = Command.all.FindByName("Spawn");
            Command freeze = Command.all.FindByName("Freeze");
            Command mute   = Command.all.FindByName("Mute");

            if (!Server.jailed.Contains(who.name))
            {
                if (!who.muted)
                {
                    mute.Use(p, message + " 10000d");
                }
                if (!who.frozen)
                {
                    freeze.Use(p, message + " 10000d");
                }

                PlayerActions.ChangeMap(who, xjailMap);
                who.BlockUntilLoad(10);
                jail.Use(p, message);
                Chat.MessageGlobal("{0} %Swas XJailed!", who.ColoredName);
            }
            else
            {
                if (who.muted)
                {
                    mute.Use(p, message);
                }
                if (who.frozen)
                {
                    freeze.Use(p, message);
                }

                PlayerActions.ChangeMap(who, Server.mainLevel);
                who.BlockUntilLoad(10);

                jail.Use(p, message);
                spawn.Use(who, "");
                Chat.MessageGlobal("{0} %Swas released from XJail!", who.ColoredName);
            }
        }
Beispiel #27
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }
            string[] parts = message.Split(' ');

            switch (parts[0].ToLower())
            {
            case "reload":
                Server.ircControllers = PlayerList.Load("IRC_Controllers.txt");
                Player.Message(p, "IRC Controllers reloaded!");
                break;

            case "add":
                if (parts.Length < 2)
                {
                    Player.Message(p, "You need to provide a name to add."); return;
                }
                if (Server.ircControllers.Contains(parts[1]))
                {
                    Player.Message(p, parts[1] + " is already an IRC controller."); return;
                }

                Server.ircControllers.Add(parts[1]);
                Server.ircControllers.Save();
                Player.Message(p, parts[1] + " added to the IRC controller list.");
                break;

            case "remove":
                if (parts.Length < 2)
                {
                    Player.Message(p, "You need to provide a name to remove."); return;
                }
                if (!Server.ircControllers.Contains(parts[1]))
                {
                    Player.Message(p, parts[1] + " is not an IRC controller."); return;
                }

                Server.ircControllers.Remove(parts[1]);
                Server.ircControllers.Save();
                Player.Message(p, parts[1] + " removed from the IRC controller list.");
                break;

            case "list":
                string names = Server.ircControllers.All().Join();
                Player.Message(p, "IRC controllers list:");
                Player.Message(p, names);
                break;

            case "rank":
                if (parts.Length < 2)
                {
                    Player.Message(p, "IRC controllers have the rank {0}",
                                   Group.GetColoredName(Server.ircControllerRank));
                    return;
                }

                Group grp = Group.FindMatches(p, parts[1]);
                if (grp == null)
                {
                    return;
                }
                if (p != null && Server.ircControllerRank > p.Rank)
                {
                    Player.Message(p, "Cannot change the IRC controllers rank, as it is currently a rank higher than yours."); return;
                }
                if (p != null && grp.Permission > p.Rank)
                {
                    Player.Message(p, "Cannot set the IRC controllers rank to a rank higher than yours."); return;
                }

                Server.ircControllerRank = grp.Permission;
                SrvProperties.Save();
                Player.Message(p, "Set IRC controller rank to {0}%S.", grp.ColoredName);
                break;

            default:
                Help(p); break;
            }
        }