SendMessage() public method

public SendMessage ( byte id, string message ) : void
id byte
message string
return void
コード例 #1
0
ファイル: CmdHidden.cs プロジェクト: duaneking/MCSharp
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                playerList = "";
                foreach (var pl in Player.players)
                {
                    if (pl.hidden && p.Rank >= pl.Rank)
                    {
                        playerList += pl.color + pl.name + "&e, ";
                    }
                }

                if (playerList == "")
                {
                    p.SendMessage("No one is currently hidden.");
                }
                else
                {
                    p.SendMessage("Hidden Players: " + playerList.Trim(trimmings));
                }
            }
            else
            {
                Help(p);
            }
        }
コード例 #2
0
ファイル: CmdRatio.cs プロジェクト: ZakAmirz/MCSharp
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Player target = Player.Find(message);
         if (target != null)
         {
             if (target.placedBlocks > 0 && target.deletedBlocks > 0)
             {
                 double ratio = ((double)target.placedBlocks / (double)target.deletedBlocks);
                 p.SendMessage(target.name + ": (" + formatRatio(target) + ") (" + target.placedBlocks + "/" + target.deletedBlocks + ")" + " (" + ratio.ToString("N4") + ")");
             }
             else
             {
                 p.SendMessage(target.name + " has not placed/deleted any bricks!");
             }
         }
         else
         {
             p.SendMessage(LanguageString.NoSuchPlayer);
         }
     }
     else
     {
         Help(p);
     }
 }
コード例 #3
0
ファイル: CmdBuildOp.cs プロジェクト: ZakAmirz/MCSharp
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                // Toggle OFF
                if (p.BlockAction == 8)
                {
                    p.BlockAction = 0;
                    p.SendMessage("BuildOp mode: &cOFF&e.");
                }
                else // Toggle ON
                {
                    // Disable painting
                    p.painting = false;

                    // Clear all bindings, creates faulty blocks otherwise
                    int bindCount = p.ClearBindings();

                    // Set the block action to buildop
                    p.BlockAction = 8;

                    if (bindCount > 0)
                    {
                        p.SendMessage("Cleared " + bindCount + " block bind(s).");
                    }

                    p.SendMessage("BuildOp Mode: &aON&e. Now Placing op_materials");
                }
            }
            else
            {
                Help(p);
            }
        }
コード例 #4
0
ファイル: CmdNews.cs プロジェクト: ZakAmirz/MCSharp
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                try
                {
                    if (File.Exists("news.txt"))
                    {
                        List<string> news = new List<string>();
                        StreamReader wm = File.OpenText("news.txt");
                        while (!wm.EndOfStream)
                            news.Add(wm.ReadLine());

                        wm.Close();

                        foreach (string w in news)
                            p.SendMessage(w);
                    }
                    else
                    {
                        p.SendMessage("No news today!");
                    }
                }
                catch
                {
                    Logger.Log("Error reading news.txt");
                }
            }
            else
            {
                Help(p);
            }
        }
コード例 #5
0
ファイル: CmdOpChat.cs プロジェクト: pazuzu156/MCSharp
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message == "")
     {
         if (p.isWhisperChat)
         {
             p.SendMessage("Disable whisper chat before using /opchat"); // Think of maybe disabling it automatically?
         }
         else
         {
             p.isOpChat = !p.isOpChat;
             if (p.isOpChat)
             {
                 p.SendMessage("Operator chat: &aON&e.");
             }
             else
             {
                 p.SendMessage("Operator chat: &cOFF&e.");
             }
         }
     }
     else
     {
         Help(p);
     }
 }
コード例 #6
0
ファイル: CmdBanip.cs プロジェクト: pazuzu156/MCSharp
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            Regex regex = new Regex(@"^([0-9]{1,3}\.){3}[0-9]{1,3}$");
            if (message == "") { if (p != null)Help(p); return; }
            Player who = null;
            who = Player.Find(message);
            if (who != null) { message = who.ip; }
            if (message.Equals("127.0.0.1")) { if (p != null) { p.SendMessage("You can't ip-ban the server!"); } return; }
            if (!regex.IsMatch(message)) { if (p != null)p.SendMessage("Not a valid ip!"); return; }
            if (p != null) { if (p.ip == message) { p.SendMessage("You can't ip-ban yourself.!"); return; } }
            if (Server.bannedIP.Contains(message)) { if (p != null)p.SendMessage(message + " is already ip-banned."); return; }
            Player.GlobalMessage(message + " got &8ip-banned&e!");
            if (p != null)
            { IRCBot.Say("IP-BANNED: " + message.ToLower() + " by " + p.name); }
            else
            { IRCBot.Say("IP-BANNED: " + message.ToLower() + " by console"); }
            Server.bannedIP.Add(message);
            Logger.Log("IP-BANNED: " + message.ToLower());

            List<Player> kickList = new List<Player>();
            foreach (Player pl in Player.players)
            {
                if (message.Equals(pl.ip)) { kickList.Add(pl); }       //Kicks anyone off with matching ip for convinience
            }
            foreach (Player pl in kickList)
            {
                pl.Kick("Kicked by ipban");
            }
        }
コード例 #7
0
ファイル: CmdLastSeen.cs プロジェクト: ZakAmirz/MCSharp
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Player target = Player.Find(message);
         if (target == null)
         {
             if (Player.lastSeen.ContainsKey(message.ToLower()))
             {
                 string lastOnline = message + " was last seen on: " + Player.lastSeen[message.ToLower()].ToLongDateString() + " at: " + Player.lastSeen[message.ToLower()].ToShortTimeString() + TimeZone.CurrentTimeZone.ToString();
                 p.SendMessage(lastOnline);
             }
             else
             {
                 p.SendMessage("Player not found!");
             }
         }
         else
         {
             if (target.hidden && p.Rank < target.Rank)
             {
                 p.SendMessage("Player not found!");
             }
             else
             {
                 p.SendMessage(target.name + " is currently playing!");
             }
         }
     }
     else
     {
         Help(p);
     }
 }
コード例 #8
0
ファイル: CmdWhisperChat.cs プロジェクト: duaneking/MCSharp
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message == "") // blank name, disable whispering
     {
         if (p.isWhisperChat)
         {
             p.SendMessage("No longer whispering: " + p.whisperTarget + ".");
             p.isWhisperChat = false;
         }
         else
         {
             p.SendMessage("Whisper chat is already disabled.");
         }
     }
     else if (p.isOpChat)
     {
         p.SendMessage("Disable opchat before using /whisper");
     }
     else
     {
         p.isWhisperChat = false;
         Player target = Player.Find(message);
         if (target != null)
         {
             p.whisperTarget = target.name;
             p.isWhisperChat = true;
             p.SendMessage("Now whispering: " + target.color + target.name + "&e.");
         }
         else
         {
             p.SendMessage(LanguageString.NoSuchPlayer);
         }
     }
 }
コード例 #9
0
ファイル: CmdMapInfo.cs プロジェクト: duaneking/MCSharp
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                p.SendMessage("Currently on &b" + p.level.name + "&e X:" + p.level.width.ToString() + " Y:" + p.level.depth.ToString() + " Z:" + p.level.height.ToString());
                switch (p.level.Physics)
                {
                    case Physics.Off:
                        p.SendMessage("Physics is &cOFF&e.");
                        break;

                    case Physics.Normal:
                        p.SendMessage("Physics is &aNormal&e.");
                        break;

                    case Physics.Advanced:
                        p.SendMessage("Physics is &aAdvanced&e.");
                        break;
                }

                p.SendMessage("Build rank = " + Map.PermissionToName(p.level.permissionbuild) + " : Visit rank = " + Map.PermissionToName(p.level.permissionvisit) + ".");
            }
            else
            {
                Help(p);
            }
        }
コード例 #10
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message != "") // Exempt or remove from exempt
            {

                // Seperate message string
                //int pos = message.IndexOf(' ');
                string tempName = message.ToLower();

                // If the name is in the file, remove it
                if (Server.griefExempted.Contains(tempName))
                {
                    Server.griefExempted.Remove(tempName);
                    p.SendMessage(tempName + " was " + c.red + "removed" + c.yellow + " from anti-grief exemption");
                }
                else
                {
                    Server.griefExempted.Add(tempName);
                    p.SendMessage(tempName + " was " + c.green + "added" + c.yellow + " to anti-grief exemption");
                }

            }
            else // Return usage
            {
                Help(p);
            }
        }
コード例 #11
0
ファイル: CmdSummon.cs プロジェクト: pazuzu156/MCSharp
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Player target = Player.Find(message);
         if (target != null)
         {
             if (!target.hidden)
             {
                 if (p.level != target.level)
                 {
                     target.ChangeLevel(p.level.name);
                 }
                 unchecked
                 {
                     target.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0);
                 }
                 target.SendMessage("You were summoned by " + p.color + p.name + "&e.");
             }
             else
             {
                 p.SendMessage("There is no player \"" + message + "\"!");
             }
         }
         else
         {
             p.SendMessage("There is no player \"" + message + "\"!");
         }
     }
     else
     {
         Help(p);
     }
 }
コード例 #12
0
ファイル: CmdWhowas.cs プロジェクト: ZakAmirz/MCSharp
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Player target = Player.Find(message);
         if (target == null || (target.hidden && p.Rank < target.Rank))
         {
             if (Player.left.ContainsKey(message.ToLower()))
             {
                 string playerName = message.ToLower();
                 string ip = Player.left[playerName];
                 message = "&e" + playerName + " is " + Player.GetColor(playerName) + Player.GetGroup(playerName).Name + "&e.";
                 if (p.Rank >= GroupEnum.Operator)
                 {
                     message += " IP: " + ip + ".";
                 }
                 p.SendChat(p, message);
             }
             else
             {
                 p.SendMessage("No entry found for \"" + message + "\".");
             }
         }
         else
         {
             p.SendMessage(target.color + target.name + "&e is online, use /whois instead.");
         }
     }
     else
     {
         Help(p);
     }
 }
コード例 #13
0
ファイル: CmdNewLvl.cs プロジェクト: Postremus/MCSharp
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message != "")
            {
                string[] parameters = message.Split(' '); // Grab the parameters from the player's message
                if (parameters.Length == 5) // make sure there are 5 params
                {
                    switch (parameters[4])
                    {
                        case "flat":
                        case "pixel":
                        case "island":
                        case "mountains":
                        case "ocean":
                        case "forest":

                            break;

                        default:
                            p.SendMessage("Valid types: island, mountains, forest, ocean, flat, pixel"); return;
                    }

                    string name = parameters[0];
                    // create a new level...
                    try
                    {
                        Map lvl = new Map(name,
                                              Convert.ToUInt16(parameters[1]),
                                              Convert.ToUInt16(parameters[2]),
                                              Convert.ToUInt16(parameters[3]),
                                              parameters[4]);
                        lvl.changed = true;
                    }
                    finally
                    {
                        GC.Collect();
                        GC.WaitForPendingFinalizers();

                    }
                    Player.GlobalMessage("Map " + name + " created");
                }
                else
                {
                    p.SendMessage("Not enough parameters! <name> <x> <y> <z> <type>");
                }
            }
            else
            {
                Help(p);
            }
            if (Properties.ValidString(message, " "))
            {

            }
            else
            {
                p.SendMessage("Please use an alphanumerical characters only!");
            }
        }
コード例 #14
0
ファイル: CmdDoor.cs プロジェクト: Postremus/MCSharp
                for (int i = 0; i < opMats.doorBlocks.Length; i++)
                {
                    if ((message.Contains(" " + Block.Name(opMats.doorBlocks[i]))) || (message.Contains(" " + Block.Name(opMats.regBlocks[i]))))
                    {
                        ignoreList[counter] = opMats.doorBlocks[i];
                        counter += 1;
                        if (counter > ignoreList.Length - 1)
                        {
                            break;
                        }
                    }
                }
            } // Not allowing user to use "all" because turning a map into door_material would be pointless
              // User can still manually do it by placing blocks.
            p.SendMessage("Place two blocks to determine the edges.");
            p.ClearBlockchange();
            p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
       
        public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
        {
            p.ClearBlockchange();
            byte b = p.level.GetTile(x, y, z); //get the tile type of first set and set that to byte b
            p.SendBlockchange(x, y, z, b);
            CatchPos bp = (CatchPos)p.blockchangeObject;
            bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
            p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
        }
        public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
        {
            p.ClearBlockchange();
            byte b = p.level.GetTile(x, y, z);
            p.SendBlockchange(x, y, z, b);
            CatchPos cpos = (CatchPos)p.blockchangeObject;
            unchecked { if (cpos.type != (byte)-1) { type = cpos.type; } }
            List<Pos> buffer = new List<Pos>();
            switch (cpos.solid)
            {
                case SolidType.solid:
                    if (!Server.operators.Contains(p.name))
                    {
                        int attemptedLimit = (Math.Abs(cpos.x - x) * Math.Abs(cpos.y - y) * Math.Abs(cpos.z - z));
                        if (attemptedLimit > p.group.CuboidLimit && p.group.CuboidLimit != 0) //OPERATOR door LIMIT, same as cuboid
                        {
                            p.SendMessage("You're trying to convert " + attemptedLimit + " blocks.");
                            p.SendMessage("Your block limit is " + p.group.CuboidLimit.ToString() + " blocks. Build in stages.");
                            return;
                        }
                    }
                    buffer.Capacity = Math.Abs(cpos.x - x) * Math.Abs(cpos.y - y) * Math.Abs(cpos.z - z);
                    for (ushort xx = Math.Min(cpos.x, x); xx <= Math.Max(cpos.x, x); ++xx)
                        for (ushort yy = Math.Min(cpos.y, y); yy <= Math.Max(cpos.y, y); ++yy)
                            for (ushort zz = Math.Min(cpos.z, z); zz <= Math.Max(cpos.z, z); ++zz)
                                /*if (p.level.GetTile(xx, yy, zz) != type) {*/
                                BufferAdd(buffer, xx, yy, zz); //}
                    break;
            }

            p.SendMessage("Converting " + buffer.Count.ToString() + " blocks into door_material.");
コード例 #15
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message != "" || message.Split(' ').Length != 2)
            {
                Player target = Player.Find(message.Split(' ')[0]);
                string levelName = message.Split(' ')[1];
                bool blnLevelLoaded = false;

                if (target == null)
                {
                    p.SendMessage("FAILED - No such player!");
                }
                else if (target.Rank >= p.Rank)
                {
                    p.SendMessage("You cannnot send a player who is an equal or greater rank than yourself");
                }
                else
                {
                    foreach (Level l in Server.levels)
                    {
                        if (l.name == levelName)
                        {
                            if (target.level.name != levelName)
                            {
                                target.SendMessage(p.name + " has sent you to " + levelName);
                                Command.all.Find("goto").Use(target, levelName);
                                blnLevelLoaded = true;
                                break;
                            }
                            else
                            {
                                p.SendMessage("Player is already on that level!");
                                blnLevelLoaded = true;
                                break;
                            }
                        }
                    }
                    if (!blnLevelLoaded)
                    {
                        DirectoryInfo di = new DirectoryInfo("levels/");
                        FileInfo[] fi = di.GetFiles("*.lvl");
                        foreach (FileInfo file in fi)
                        {
                            if (file.Name.Replace(".lvl", "").ToLower() == levelName.ToLower())
                            {
                                p.SendMessage("That Level is not loaded yet!");
                            }
                        }
                        p.SendMessage("No such level!");
                    }
                }
            }
            else
            {
                Help(p);
            }
        }
コード例 #16
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            //p.SendMessage("Sorry this command is temporarily disabled");

            if (message != "" && message.Split(' ').Length <= 2)
            {
                int pos = message.IndexOf(' ');
                if (pos != -1)
                {
                    Player target = Player.Find(message.Substring(0, pos));
                    if (target == null)
                    {
                        p.SendMessage("There is no player \"" + message.Substring(0, pos) + "\"!");
                    }
                    else
                    {

                        string color = c.Parse(message.Substring(pos + 1));
                        if (color == "")
                        {
                            p.SendMessage("There is no color \"" + message + "\".");
                        }
                        else if (color == target.color)
                        {
                            p.SendMessage(target.name + " already has that color.");
                        }
                        else
                        {
                            Player.GlobalChat(target, target.color + "*" + FormatName(target.name) + " color changed to " + color + c.Name(color) + "&e.", false);
                            target.color = color;

                            Player.GlobalDie(target, false);
                            Player.GlobalSpawn(target, target.pos[0], target.pos[1], target.pos[2], target.rot[0], target.rot[1], false);
                        }
                    }
                }
                else
                {
                    string color = c.Parse(message);
                    if (color == "") { p.SendMessage("There is no color \"" + message + "\"."); }
                    else if (color == p.color) { p.SendMessage("You already have that color."); }
                    else
                    {
                        Player.GlobalChat(p, p.color + "*" + FormatName(p.name) +
                                          " color changed to " + color +
                                          c.Name(color) + "&e.", false);
                        p.color = color; Player.GlobalDie(p, false);
                        Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
                    }
                }
            }
            else
            {
                Help(p);
            }
        }
コード例 #17
0
ファイル: CmdClones.cs プロジェクト: Voziv/MCSharp
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {

                // Check for clones
                foreach (Player pl in Player.players)
                {
                    foreach (Player pl1 in Player.players)
                    {
                        if (pl.ip == pl1.ip && pl.name != pl1.name)     //If same IP found on another player
                        {
                            if (!clones.ContainsKey(pl.ip))     //If the key does not exist yet
                            {
                                clones.Add(pl.ip, new List<string>());
                                clones[pl.ip].Add(pl.name);
                                clones[pl.ip].Add(pl1.name);    //add playername to the list
                            }
                            else
                            {
                                if (!clones[pl.ip].Contains(pl1.name))
                                {
                                    clones[pl.ip].Add(pl1.name);
                                }
                            }
                        }
                    }
                }

                // List clones
                if (clones.Count > 0)
                {
                    p.SendMessage("Clones have been found!");
                    foreach (KeyValuePair<string, List<string>> kvp in clones)
                    {
                        string players = "";
                        foreach (string s in kvp.Value)
                        {
                            Player fplayer = Player.Find(s);
                            players += fplayer.color + s + "&e, ";
                        }
                        p.SendMessage(kvp.Key + ": " + players.Trim(trimmings));
                    }
                    clones.Clear();
                }
                else
                {
                    p.SendMessage("No Clones Found");
                }
            }
            else
            {
                Help(p);
            }
        }
コード例 #18
0
ファイル: CmdRules.cs プロジェクト: ZakAmirz/MCSharp
 // Command usage help
 public override void Help(Player p)
 {
     if (p.Rank < GroupEnum.Moderator)
     {
         p.SendMessage("/rules - Displays server rules");
     }
     else
     {
         p.SendMessage("/rules [player]- Displays server rules to a player");
     }
 }
コード例 #19
0
ファイル: CmdAbort.cs プロジェクト: pazuzu156/MCSharp
 // Code to run when used by a player
 public override void Use(Player p,string message)
 {
     if (p.HasBlockchange())
     {
         p.SendMessage("There is no action to abort.");
     }
     else
     {
         p.ClearBlockchange();
         p.SendMessage("Action aborted.");
     }
 }
コード例 #20
0
ファイル: CmdUnlock.cs プロジェクト: duaneking/MCSharp
        public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
        {
            p.ClearBlockchange();
            byte b = p.level.GetTile(x, y, z);
            p.SendBlockchange(x, y, z, b);
            CatchPos cpos = (CatchPos)p.blockchangeObject;
            unchecked { if (cpos.type != (byte)-1) { type = cpos.type; } }
            List<Pos> buffer = new List<Pos>();
            switch (cpos.solid)
            {
                case SolidType.solid:
                    if (!Server.operators.Contains(p.name))
                    {
                        int attemptedLimit = Math.Abs(cpos.x - x) * Math.Abs(cpos.y - y) * Math.Abs(cpos.z - z);
                        if (attemptedLimit > p.group.CuboidLimit && p.group.CuboidLimit != 0) //OPERATOR unlock LIMIT, same as cuboid
                        {
                            p.SendMessage("You're trying to unlock " + attemptedLimit + " blocks.");
                            p.SendMessage("Your block limit is " + p.group.CuboidLimit.ToString() + " blocks. Build in stages.");
                            return;
                        }
                    }
                    buffer.Capacity = Math.Abs(cpos.x - x) * Math.Abs(cpos.y - y) * Math.Abs(cpos.z - z);
                    for (ushort xx = Math.Min(cpos.x, x); xx <= Math.Max(cpos.x, x); ++xx)
                        for (ushort yy = Math.Min(cpos.y, y); yy <= Math.Max(cpos.y, y); ++yy)
                            for (ushort zz = Math.Min(cpos.z, z); zz <= Math.Max(cpos.z, z); ++zz)
                                /*if (p.level.GetTile(xx, yy, zz) != type) {*/
                                BufferAdd(buffer, xx, yy, zz); //}
                    break;
            }

            p.SendMessage("Unlocking " + buffer.Count.ToString() + " blocks.");

            // Disable physics before changing the blocks
            Physics physicsSetting = p.level.Physics;
            p.level.Physics = Physics.Off;
            p.level.ClearPhysics();

            buffer.ForEach(delegate(Pos pos)
            {
                byte bl = p.level.GetTile(pos.x, pos.y, pos.z); //Get the block that is there at the moment
                if (opMats.opBlocks.Contains(bl))  // if the block is op_material
                {

                    if (!ignoreList.Contains(bl)) // if the block is not being ignored
                    {
                        p.level.Blockchange(p, pos.x, pos.y, pos.z, (byte)Block.convertOp(bl)); // send converted reg_material
                    }
                }
            });
            //p.level.Blockchange(p, pos.x, pos.y, pos.z, (byte)(Block.lavastill));
            p.level.Physics = physicsSetting;
            p.SendMessage("Unlocking complete.");
        }
コード例 #21
0
ファイル: CmdReveal.cs プロジェクト: Voziv/MCSharp
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message != "")
            {
                Player target = Player.Find(message);
                if (target != null)
                {
                    if (target.Rank == GroupEnum.Banned)
                    {
                        target.Loading = true;
                        ushort x = p.pos[0];
                        ushort y = p.pos[1];
                        ushort z = p.pos[2];
                        byte rotX = p.rot[0];
                        byte rotY = p.rot[1];

                        //who.SendMotd(); who.SendMap();

                        target.ClearBlockchange();
                        target.BlockAction = 0;
                        target.SendMotd();
                        target.SendMap();

                        unchecked
                        {
                            target.SendPos((byte)-1, x, y, z,
                                rotX,
                                rotY);
                        }

                        target.SendMessage("Oops, looks like all your greifing was for nothing!");
                        p.SendMessage("Map revealed for: " + target.color + target.name);
                        Player.GlobalMessageOps("-" + p.color + p.name + "&e just revealed the map to: " + target.color + target.name);
                        target.Loading = false;
                        GC.Collect();
                        GC.WaitForPendingFinalizers();
                    }
                    else
                    {
                        p.SendMessage("Player is not banned!");
                    }
                }
                else
                {
                    p.SendMessage("There is no player \"" + message + "\"!");
                }
            }
            else
            {
                Help(p);
            }
        }
コード例 #22
0
ファイル: CmdGoto.cs プロジェクト: TaFinalDestination/MCSharp
        // Code to run when used by a player
        public override void Use(Player p,string message)
        {
            bool blnLevelFound = false;
            Level targetLevel = null;
            if (message != "")
            {
                message = message.ToLower();
                if (p.level.name.ToLower() != message)
                {
                    foreach (Level level in Server.levels)
                    {
                        if (level.name.ToLower() == message)
                        {
                            targetLevel = level;
                            blnLevelFound = true;
                            break;
                        }
                    }
                    if (blnLevelFound)
                    {
                        if (targetLevel.PlayerCanVisit(p))
                        {
                            p.ChangeLevel(targetLevel);
                            if (!p.hidden)
                            {
                                Player.GlobalChat(p, p.color + "*" + p.name + "&e went to \"" + p.level.name + "\".", false);
                            }
                        }
                        else
                        {
                            p.SendMessage("You do not have perimssion to visit this level");
                        }
                    }
                    else
                    {
                        // Level either not found or non-existant

                        p.SendMessage("There is no level \"" + message + "\" loaded.");
                    }

                }
                else
                {
                    p.SendMessage("You are already on that level!");
                }
            }
            else
            {
                Help(p);
            }
        }
コード例 #23
0
ファイル: CmdActiveWater.cs プロジェクト: Voziv/MCSharp
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (p.BlockAction == 5)
     {
         p.BlockAction = 0;
         p.SendMessage("Active water aborted.");
     }
     else
     {
         p.BlockAction = 5;
         p.SendMessage("Now placing &cactive_water&e!");
     }
     p.painting = false;
 }
コード例 #24
0
ファイル: CmdInfo.cs プロジェクト: pazuzu156/MCSharp
 // Code to run when used by a player
 public override void Use(Player p,string message)
 {
     if (message == "")
     {
         p.SendMessage("MCsharp Revision " + Server.Version + ".");
         p.SendMessage("Developed and maintained by the MCSharp Development Team.");
         p.SendMessage("Official channel: &2#mcsharp @ irc.esper.net&e.");
         p.SendMessage("Visit our website at http://crafted.voziv.com");
     }
     else
     {
         Help(p);
     }
 }
コード例 #25
0
ファイル: CmdLava.cs プロジェクト: pazuzu156/MCSharp
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (p.BlockAction == 2)
     {
         p.BlockAction = 0;
         p.SendMessage("Lava mode: &cOFF&e.");
     }
     else
     {
         p.BlockAction = 2;
         p.SendMessage("Lava Mode: &aON&e.");
         p.painting = false;
     }
 }
コード例 #26
0
ファイル: CmdKick.cs プロジェクト: duaneking/MCSharp
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message != "")
            {
                string who = message;
                int index = message.IndexOf(' ');

                if (index != -1)
                {
                    who = message.Substring(0, index);
                    message = message.Substring(index + 1);
                }

                // Find the player and ensure they are online
                Player target = Player.Find(who);
                if (target != null)
                {
                    if (p.Rank > target.Rank)
                    {
                        if (target != p)
                        {
                            if (index == -1)
                            {
                                target.Kick("You were kicked by " + p.name + "!");
                                IRCBot.Say(who + " was kicked by " + p.name);
                            }
                            else
                            {
                                target.Kick(message);
                                IRCBot.Say(who + " was kicked by " + p.name + "(" + message + ")");
                            }
                        }
                        else
                        {
                            p.SendMessage("You can't kick yourself!");
                        }
                    }
                    else
                    {
                        p.SendMessage("You can't kick someone of equal or higher rank!");
                    }
                }
                else { p.SendMessage("There is no player called \"" + who + "\" currently online!"); }
            }
            else
            {
                Help(p);
            }
        }
コード例 #27
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message != "")
            {
                try
                {
                    int temp = int.Parse(message);
                    if (temp >= 0 && temp <= 2)
                    {
                        p.level.physics = temp;
                        switch (temp)
                        {
                            case 0:
                                p.level.ClearPhysics();
                                Player.GlobalMessageLevel(p.level, "Physics is now &cOFF&e on &b" + p.level.name + "&e.");
                                Logger.Log("Physics is now OFF on " + p.level.name + ".");
                                IRCBot.Say("Physics is now OFF on " + p.level.name + ".");
                                break;

                            case 1:
                                Player.GlobalMessageLevel(p.level, "Physics is now &aNormal&e on &b" + p.level.name + "&e.");
                                Logger.Log("Physics is now ON on " + p.level.name + ".");
                                IRCBot.Say("Physics is now ON on " + p.level.name + ".");
                                break;

                            case 2:
                                Player.GlobalMessageLevel(p.level, "Physics is now &aAdvanced&e on &b" + p.level.name + "&e.");
                                Logger.Log("Physics is now ADVANCED on " + p.level.name + ".");
                                IRCBot.Say("Physics is now ADVANCED on " + p.level.name + ".");
                                break;
                        }

                    }
                    else
                    {
                        p.SendMessage("Not a valid setting");
                    }
                }
                catch
                {
                    p.SendMessage("INVALID INPUT");
                }
            }
            else
            {
                Help(p);
            }
        }
コード例 #28
0
ファイル: CmdOps.cs プロジェクト: TaFinalDestination/MCSharp
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                string strOperators = "";
                Player.players.ForEach(delegate(Player pl)
                {
                    if (pl.Rank == GroupEnum.Operator && (!pl.hidden || p.Rank >= pl.Rank))
                    {
                        strOperators += pl.color + pl.name + ", ";
                    }
                });
                if (strOperators == "")
                {
                    strOperators = "No operators currently online";
                }
                else
                {
                    strOperators = strOperators.Remove(strOperators.Length - 2);
                }

                p.SendMessage("Online Operators: " + strOperators);
            }
            else
            {
                Help(p);
            }
        }
コード例 #29
0
ファイル: CmdAfk.cs プロジェクト: Voziv/MCSharp
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message != "list")
     {
         if (Server.afkset.Contains(p.name))
         {
             Server.afkset.Remove(p.name);
             Player.GlobalMessage("-" + p.group.Color + p.name + "&e- is no longer AFK");
             IRCBot.Say(p.name + " is no longer AFK");
         }
         else
         {
             Server.afkset.Add(p.name);
             Player.GlobalMessage("-" + p.group.Color + p.name + "&e- is AFK " + message);
             IRCBot.Say(p.name + " is AFK " + message);
         }
     }
     else
     {
         // Send list of afk players
         foreach (string s in Server.afkset)
         {
             p.SendMessage(s);
         }
     }
 }
コード例 #30
0
        /// <summary>
        /// Sends the rules to a target player
        /// </summary>
        /// <param name="target">Target player that rules are being sent to.</param>
        private void SendRules(Player target)
        {
            try
            {
                if (target.level == Server.mainLevel && Server.mainLevel.permissionbuild == LevelPermission.Guest)
                {
                    target.SendMessage("You are currently on the guest map where anyone can build");
                }

                List<string> rules = new List<string>();

                // Read in rules
                StreamReader r = File.OpenText("rules.txt");
                while (!r.EndOfStream)
                    rules.Add(r.ReadLine());
                r.Close();

                // Send the user the rules
                target.SendMessage("Server Rules:");
                foreach (string rule in rules)
                    target.SendMessage(rule);

            }
            catch
            {
                Logger.Log("Error reading rules.txt in SendRules()", LogType.Error);
            }
        }
コード例 #31
0
 // Command usage help
 public override void Help(Player p)
 {
     p.SendMessage("/unbanip <ip> - Un-bans an ip.");
 }
コード例 #32
0
 // Command usage help
 public override void Help(Player p)
 {
     p.SendMessage("/buildDoor - Toggles build door mode. When activated, all blocks will turn into doors when placed.");
 }
コード例 #33
0
ファイル: CmdAdmins.cs プロジェクト: MinedroidFTW/MCSharp
 // Command usage help
 public override void Help(Player p)
 {
     p.SendMessage("/admins - List the admins of the server");
 }
コード例 #34
0
ファイル: CmdDoor.cs プロジェクト: MinedroidFTW/MCSharp
 // Command usage help
 public override void Help(Player p)
 {
     p.SendMessage("/door - Convert all blocks in an area to door_material");
     p.SendMessage("/door <block(s)>  ignores that block, max 7");
 }
コード例 #35
0
ファイル: Command.cs プロジェクト: MinedroidFTW/MCSharp
 // Code to run when used by a player
 public virtual void Use(Player p, string message)
 {
     p.SendMessage("Uh oh, this shouldn't have happened. Please report what you did to get here to Voziv!");
     Logger.Log("A player tried to use a command that resulted in a catastrophic failure!", LogType.Error);
     Logger.Log("The command name was " + strName, LogType.Error);
 }
コード例 #36
0
ファイル: Command.cs プロジェクト: MinedroidFTW/MCSharp
 // Override this
 public virtual void Help(Player p)
 {
     p.SendMessage("This is not a valid help command. Please report what you did to get here to Voziv!");
 }