コード例 #1
0
 static void UpdateGlobal(Player p) {
     Player[] players = PlayerInfo.Online.Items;
     foreach (Player pl in players) {
         pl.SendCurrentTextures();
     }
     SrvProperties.Save();
 }
コード例 #2
0
ファイル: CmdServer.cs プロジェクト: rdebath/MCGalaxy
 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();
 }
コード例 #3
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();
 }
コード例 #4
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();
        }
コード例 #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);
        }
コード例 #6
0
ファイル: CmdTexture.cs プロジェクト: Benedani/MCGalaxy
 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();
 }
コード例 #7
0
ファイル: CmdLimit.cs プロジェクト: DiresHosting/MCDire
 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();
     }
 }
コード例 #8
0
ファイル: CmdTexture.cs プロジェクト: ProtheanGod/KingMC
 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();
 }
コード例 #9
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();
 }
コード例 #10
0
        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);
        }
コード例 #11
0
ファイル: CmdMain.cs プロジェクト: ProtheanGod/KingMC
        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);
            }
        }
コード例 #12
0
ファイル: CmdMain.cs プロジェクト: DiresHosting/MCDire
        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);
            }
        }
コード例 #13
0
ファイル: CmdZombieGame.cs プロジェクト: Peteys93/MCGalaxy
        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();
            }
        }
コード例 #14
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");
            }
        }
コード例 #15
0
ファイル: CmdZombieGame.cs プロジェクト: Peteys93/MCGalaxy
        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();
            }
        }
コード例 #16
0
ファイル: CmdLimit.cs プロジェクト: DiresHosting/MCDire
        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();
            }
        }
コード例 #17
0
ファイル: CmdMain.cs プロジェクト: Benedani/MCGalaxy
        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);
            }
        }
コード例 #18
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");
            }
        }
コード例 #19
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);
        }
コード例 #20
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;
            }
        }
コード例 #21
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;
            }
        }
コード例 #22
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);
            }
        }
コード例 #23
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;
            }
        }