当前位置: 首页>>代码示例>>C#>>正文


C# Player.ClearBlockchange方法代码示例

本文整理汇总了C#中Player.ClearBlockchange方法的典型用法代码示例。如果您正苦于以下问题:C# Player.ClearBlockchange方法的具体用法?C# Player.ClearBlockchange怎么用?C# Player.ClearBlockchange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player.ClearBlockchange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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;

                    Level.Zone Zn;

                    Zn.smallX = Math.Min(cpos.x, x);
                    Zn.smallY = Math.Min(cpos.y, y);
                    Zn.smallZ = Math.Min(cpos.z, z);
                    Zn.bigX = Math.Max(cpos.x, x);
                    Zn.bigY = Math.Max(cpos.y, y);
                    Zn.bigZ = Math.Max(cpos.z, z);
                    Zn.Owner = cpos.Owner;

                    p.level.ZoneList.Add(Zn);

                    //DB
                    if (Server.useMySQL) MySQL.executeQuery("INSERT INTO `Zone" + p.level.name + "` (SmallX, SmallY, SmallZ, BigX, BigY, BigZ, Owner) VALUES (" + Zn.smallX + ", " + Zn.smallY + ", " + Zn.smallZ + ", " + Zn.bigX + ", " + Zn.bigY + ", " + Zn.bigZ + ", '" + Zn.Owner + "')"); else SQLite.executeQuery("INSERT INTO `Zone" + p.level.name + "` (SmallX, SmallY, SmallZ, BigX, BigY, BigZ, Owner) VALUES (" + Zn.smallX + ", " + Zn.smallY + ", " + Zn.smallZ + ", " + Zn.bigX + ", " + Zn.bigY + ", " + Zn.bigZ + ", '" + Zn.Owner + "')");
                    //DB

                    Player.SendMessage(p, "Added zone for &b" + cpos.Owner);
        }
开发者ID:Cazzar,项目名称:MCForge-MCLawl,代码行数:25,代码来源:CmdZone.cs

示例2: Blockchange1

        public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
        {
            p.ClearBlockchange();
            CatchPos cpos = (CatchPos)p.blockchangeObject;

            cpos.message = cpos.message.Replace("'", "\\'");

            if ( !Regex.IsMatch(cpos.message.ToLower(), @"^[a-z0-9]*?$") ) {
                Player.SendMessage(p, "That is not allowed");
                return;
            }

            DataTable Messages = Server.useMySQL ? MySQL.fillData("SELECT * FROM `Messages" + p.level.name + "` WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z) : SQLite.fillData("SELECT * FROM `Messages" + p.level.name + "` WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z);
            Messages.Dispose();

            if ( Messages.Rows.Count == 0 ) {
                if ( Server.useMySQL ) MySQL.executeQuery("INSERT INTO `Messages" + p.level.name + "` (X, Y, Z, Message) VALUES (" + (int)x + ", " + (int)y + ", " + (int)z + ", '" + cpos.message + "')"); else SQLite.executeQuery("INSERT INTO `Messages" + p.level.name + "` (X, Y, Z, Message) VALUES (" + (int)x + ", " + (int)y + ", " + (int)z + ", '" + cpos.message + "')");
            }
            else {
                if ( Server.useMySQL ) MySQL.executeQuery("UPDATE `Messages" + p.level.name + "` SET Message='" + cpos.message + "' WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z); else SQLite.executeQuery("UPDATE `Messages" + p.level.name + "` SET Message='" + cpos.message + "' WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z);
            }

            Player.SendMessage(p, "Message block placed.");
            p.level.Blockchange(p, x, y, z, cpos.type);
            p.SendBlockchange(x, y, z, cpos.type);

            if ( p.staticCommands ) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
开发者ID:Peteys93,项目名称:MCForge-MCLawl,代码行数:28,代码来源:CmdMessageBlock.cs

示例3: Blockchange2

        public void Blockchange2(Player p, ushort x, ushort y, ushort z, ushort type)
        {
            p.ClearBlockchange();
            ushort b = p.level.GetTile(x, y, z);
            p.SendBlockchange(x, y, z, b);
            CatchPos cpos = (CatchPos)p.blockchangeObject;

            Level.Zone Zn;

            Zn.smallX = Math.Min(cpos.x, x);
            Zn.smallY = Math.Min(cpos.y, y);
            Zn.smallZ = Math.Min(cpos.z, z);
            Zn.bigX = Math.Max(cpos.x, x);
            Zn.bigY = Math.Max(cpos.y, y);
            Zn.bigZ = Math.Max(cpos.z, z);
            Zn.Owner = cpos.Owner;

            p.level.ZoneList.Add(Zn);

            //DB
            Database.AddParams("@Owner", Zn.Owner);
            Database.executeQuery("INSERT INTO `Zone" + p.level.name + "` (SmallX, SmallY, SmallZ, BigX, BigY, BigZ, Owner) VALUES (" + Zn.smallX + ", " + Zn.smallY + ", " + Zn.smallZ + ", " + Zn.bigX + ", " + Zn.bigY + ", " + Zn.bigZ + ", @Owner)");
            //DB

            Player.SendMessage(p, "Added zone for &b" + cpos.Owner);
        }
开发者ID:Goodlyay,项目名称:MCForge-Vanilla-Redux,代码行数:26,代码来源:CmdZone.cs

示例4: Use

        public override void Use(Player p, string message)
        {
            distance = 0; interval = 0;
            if (message == "") { Help(p); return; }
            if (message.Split(' ').Length > 1)
            {
                try { ushort.TryParse(message.Split(' ')[0], out distance); }
                catch { Player.SendMessage(p, "Distance must be a number."); return; }
                try { ushort.TryParse(message.Split(' ')[1], out interval); }
                catch { Player.SendMessage(p, "Interval must be a number."); return; }
            }
            else
            {
                try { ushort.TryParse(message, out distance); }
                catch { Player.SendMessage(p, "Distance must be a number."); return; }
            }
            if (distance < 1)
            {
                Player.SendMessage(p, "Enter a distance greater than 0."); return;
            }
            if (interval >= distance)
            {
                Player.SendMessage(p, "The Interval cannot be greater than the distance."); return;
            }

            CatchPos cpos;
            cpos.givenMessage = message;
            cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
            Player.SendMessage(p, "Place two blocks to determine direction.");
            p.ClearBlockchange();
            p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:32,代码来源:CmdSPlace.cs

示例5: Use

 public override void Use(Player p, string message)
 {
     if (message != "") { Help(p); return; }
     p.SendMessage("Break/build a block to see who edited it last.");
     p.ClearBlockchange();
     p.Blockchange += new Player.BlockchangeEventHandler(Blockchange);
 }
开发者ID:Balthizar01,项目名称:MCForge-Vanilla-Redux,代码行数:7,代码来源:CmdWhodid.cs

示例6: 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.level.Blockchange(p, x, y, z, Block.c4det);
     Player.SendMessage(p, "Placed detonator block!");
 }
开发者ID:B00mX0r,项目名称:MCForge-MCLawl,代码行数:7,代码来源:CmdC4.cs

示例7: Blockchange2

 public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
 {
     p.ClearBlockchange();
     //            byte b = p.level.GetTile(x, y, z) // Unused method, wasting mah .exe spaces;
     p.level.Blockchange(p, x, y, z, Block.c4det);
     Player.SendMessage(p, "Placed detonator block!");
 }
开发者ID:PinEvil,项目名称:MCForge-Vanilla,代码行数:7,代码来源:CmdC4.cs

示例8: Use

 public override void Use(Player p, string message)
 {
     if (p != null)
     {
         p.ClearBlockchange();
         p.painting = false;
         p.BlockAction = 0;
         p.cmdTimer = false;
         p.staticCommands = false;
         p.deleteMode = false;
         p.ZoneCheck = false;
         p.modeType = 0;
         p.aiming = false;
         p.onTrain = false;
         p.isFlying = false;
         try
         {
             p.level.blockqueue.RemoveAll(b => b.p == p);
         }
         finally { BlockQueue.resume(); }
         Player.SendMessage(p, "Every toggle or action was aborted.");
         return;
     }
     Player.SendMessage(p, "This command can only be used in-game!");
 }
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:25,代码来源:CmdAbort.cs

示例9: EntryChange

        public void EntryChange(Player p, ushort x, ushort y, ushort z, byte type, byte extType)
        {
            p.ClearBlockchange();
            portalPos bp = (portalPos)p.blockchangeObject;

            if (bp.Multi && type == Block.red && bp.port.Count > 0) { ExitChange(p, x, y, z, type, extType); return; }

            byte b = p.level.GetTile(x, y, z);
            p.level.Blockchange(p, x, y, z, bp.type);
            p.SendBlockchange(x, y, z, Block.green);
            portPos Port;

            Port.portMapName = p.level.name;
            Port.x = x; Port.y = y; Port.z = z;

            bp.port.Add(Port);

            p.blockchangeObject = bp;

            if (!bp.Multi)
            {
                p.Blockchange += ExitChange;
                Player.SendMessage(p, "&aEntry block placed");
            }
            else
            {
                p.Blockchange += EntryChange;
                Player.SendMessage(p, "&aEntry block placed. &cRed block for exit");
            }
        }
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:30,代码来源:CmdPortal.cs

示例10: EntryChange

        public void EntryChange(Player p, ushort x, ushort y, ushort z, byte type)
        {
            p.ClearBlockchange();
            portalPos bp = (portalPos)p.blockchangeObject;

            if (bp.Multi && type == Block.red && bp.port.Count > 0) { ExitChange(p, x, y, z, type); return; }

            //            byte b = p.level.GetTile(x, y, z) // Unused method, wasting mah .exe spaces;
            p.level.Blockchange(p, x, y, z, bp.type);
            p.SendBlockchange(x, y, z, Block.green);
            portPos Port;

            Port.portMapName = p.level.name;
            Port.x = x; Port.y = y; Port.z = z;

            bp.port.Add(Port);

            p.blockchangeObject = bp;

            if (!bp.Multi)
            {
                p.Blockchange += new Player.BlockchangeEventHandler(ExitChange);
                Player.SendMessage(p, "&aEntry block placed");
            }
            else
            {
                p.Blockchange += new Player.BlockchangeEventHandler(EntryChange);
                Player.SendMessage(p, "&aEntry block placed. &cRed block for exit");
            }
        }
开发者ID:PinEvil,项目名称:MCForge-Vanilla,代码行数:30,代码来源:CmdPortal.cs

示例11: Use

        public override void Use(Player p, string message)
        {
            p.staticCommands = !p.staticCommands;
            p.ClearBlockchange();
            p.BlockAction = 0;

            Player.SendMessage(p, "Static mode: &a" + p.staticCommands.ToString());

            try
            {
                if (message != "")
                {
                    if (message.IndexOf(' ') == -1)
                    {
                        if (p.group.CanExecute(Command.all.Find(message)))
                            Command.all.Find(message).Use(p, "");
                        else
                            Player.SendMessage(p, "Cannot use that command.");
                    }
                    else
                    {
                        if (p.group.CanExecute(Command.all.Find(message.Split(' ')[0])))
                            Command.all.Find(message.Split(' ')[0]).Use(p, message.Substring(message.IndexOf(' ') + 1));
                        else
                            Player.SendMessage(p, "Cannot use that command.");
                    }
                }
            }
            catch { Player.SendMessage(p, "Could not find specified command"); }
        }
开发者ID:hirsty,项目名称:MCForge-Vanilla,代码行数:30,代码来源:CmdStatic.cs

示例12: Blockchange1

        public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
        {
            p.ClearBlockchange();
            CatchPos cpos = (CatchPos)p.blockchangeObject;

            cpos.message = cpos.message.Replace("'", "\\'");

            if ( !Regex.IsMatch(cpos.message.ToLower(), @".*%([0-9]|[a-f]|[k-r])%([0-9]|[a-f]|[k-r])%([0-9]|[a-f]|[k-r])") ) {
                if (Regex.IsMatch(cpos.message.ToLower(), @".*%([0-9]|[a-f]|[k-r])(.+?).*")) {
                    Regex rg = new Regex(@"%([0-9]|[a-f]|[k-r])(.+?)");
                    MatchCollection mc = rg.Matches(cpos.message.ToLower());
                    if (mc.Count > 0) {
                        Match ma = mc[0];
                        GroupCollection gc = ma.Groups;
                        cpos.message.Replace("%" + gc[1].ToString().Substring(1), "&" + gc[1].ToString().Substring(1));
                    }
                }
            }

            DataTable Messages = Server.useMySQL ? MySQL.fillData("SELECT * FROM `Messages" + p.level.name + "` WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z) : SQLite.fillData("SELECT * FROM `Messages" + p.level.name + "` WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z);
            Messages.Dispose();

            if ( Messages.Rows.Count == 0 ) {
                if ( Server.useMySQL ) MySQL.executeQuery("INSERT INTO `Messages" + p.level.name + "` (X, Y, Z, Message) VALUES (" + (int)x + ", " + (int)y + ", " + (int)z + ", '" + cpos.message + "')"); else SQLite.executeQuery("INSERT INTO `Messages" + p.level.name + "` (X, Y, Z, Message) VALUES (" + (int)x + ", " + (int)y + ", " + (int)z + ", '" + cpos.message + "')");
            }
            else {
                if ( Server.useMySQL ) MySQL.executeQuery("UPDATE `Messages" + p.level.name + "` SET Message='" + cpos.message + "' WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z); else SQLite.executeQuery("UPDATE `Messages" + p.level.name + "` SET Message='" + cpos.message + "' WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z);
            }

            Player.SendMessage(p, "Message block placed.");
            p.level.Blockchange(p, x, y, z, cpos.type);
            p.SendBlockchange(x, y, z, cpos.type);

            if ( p.staticCommands ) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
开发者ID:B00mX0r,项目名称:MCForge-MCLawl,代码行数:35,代码来源:CmdMessageBlock.cs

示例13: Blockchange1

        public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
        {
            if (!p.staticCommands) p.ClearBlockchange();
            CatchPos cpos = (CatchPos)p.blockchangeObject;
            byte oldType = p.level.GetTile(x, y, z);
            p.SendBlockchange(x, y, z, oldType);

            int diffX = 0, diffZ = 0;

            if (p.rot[0] <= 32 || p.rot[0] >= 224) { diffZ = -1; }
            else if (p.rot[0] <= 96) { diffX = 1; }
            else if (p.rot[0] <= 160) { diffZ = 1; }
            else diffX = -1;

            List<Pos> buffer = new List<Pos>();
            Pos pos;
            int total = 0;

            if (diffX != 0)
            {
                for (ushort xx = x; total < cpos.distance; xx += (ushort)diffX)
                {
                    for (ushort yy = (ushort)(y - 1); yy <= (ushort)(y + 1); yy++)
                        for (ushort zz = (ushort)(z - 1); zz <= (ushort)(z + 1); zz++)
                        {
                            pos.x = xx; pos.y = yy; pos.z = zz;
                            buffer.Add(pos);
                        }
                    total++;
                }
            }
            else
            {
                for (ushort zz = z; total < cpos.distance; zz += (ushort)diffZ)
                {
                    for (ushort yy = (ushort)(y - 1); yy <= (ushort)(y + 1); yy++)
                        for (ushort xx = (ushort)(x - 1); xx <= (ushort)(x + 1); xx++)
                        {
                            pos.x = xx; pos.y = yy; pos.z = zz;
                            buffer.Add(pos);
                        }
                    total++;
                }
            }

            if (buffer.Count > p.group.maxBlocks)
            {
                Player.SendMessage(p, "You tried to drill " + buffer.Count + " blocks.");
                Player.SendMessage(p, "You cannot drill more than " + p.group.maxBlocks + ".");
                return;
            }

            foreach (Pos pos1 in buffer)
            {
                if (p.level.GetTile(pos1.x, pos1.y, pos1.z) == oldType)
                    p.level.Blockchange(p, pos1.x, pos1.y, pos1.z, Block.air);
            }
            Player.SendMessage(p, buffer.Count + " blocks.");
        }
开发者ID:xShOtDoOdx,项目名称:MCForge-MCLawl,代码行数:59,代码来源:CmdDrill.cs

示例14: 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;
                List<CatchPos> buffer = new List<CatchPos>();
                CatchPos pos = new CatchPos();
                //int totalChecks = 0;

                //if (Math.Abs(cpos.x - x) * Math.Abs(cpos.y - y) * Math.Abs(cpos.z - z) > 8000) { Player.SendMessage(p, "Tried to restart too many blocks. You may only restart 8000"); return; }

                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) != Block.air)
                            {
                                pos.x = xx; pos.y = yy; pos.z = zz;
                                pos.extraInfo = cpos.extraInfo;
                                buffer.Add(pos);
                            }
                        }
                    }
                }

                try
                {
                    if (cpos.extraInfo == "")
                    {
                        if (buffer.Count > Server.rpNormLimit)
                        {
                            Player.SendMessage(p, "Cannot restart more than " + Server.rpNormLimit + " blocks.");
                            Player.SendMessage(p, "Tried to restart " + buffer.Count + " blocks.");
                            return;
                        }
                    }
                    else
                    {
                        if (buffer.Count > Server.rpLimit)
                        {
                            Player.SendMessage(p, "Tried to add physics to " + buffer.Count + " blocks.");
                            Player.SendMessage(p, "Cannot add physics to more than " + Server.rpLimit + " blocks.");
                            return;
                        }
                    }
                }
                catch { return; }

                foreach (CatchPos pos1 in buffer)
                {
                    p.level.AddCheck(p.level.PosToInt(pos1.x, pos1.y, pos1.z), pos1.extraInfo, true);
                }

                Player.SendMessage(p, "Activated " + buffer.Count + " blocks.");
                if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
开发者ID:Cazzar,项目名称:MCForge-MCLawl,代码行数:59,代码来源:CmdRestartPhysics.cs

示例15: AboutBlockchange

        public void AboutBlockchange(Player p, ushort x, ushort y, ushort z, byte type)
        {
            if (!p.staticCommands) p.ClearBlockchange();
            byte b = p.level.GetTile(x, y, z);
            if (b == Block.Zero) { Player.SendMessage(p, "Invalid Block(" + x + "," + y + "," + z + ")!"); return; }
            p.SendBlockchange(x, y, z, b);

            string message = "Block (" + x + "," + y + "," + z + "): ";
            message += "&f" + b + " = " + Block.Name(b);
            Player.SendMessage(p, message + Server.DefaultColor + ".");
            message = p.level.foundInfo(x, y, z);
            if (message != "") Player.SendMessage(p, "Physics information: &a" + message);

            //safe against SQL injections because no user input is given here
            DataTable Blocks = Database.fillData("SELECT * FROM Block" + p.level.name + " WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z);

            string Username, TimePerformed, BlockUsed;
            bool Deleted, foundOne = false;
            for (int i = 0; i < Blocks.Rows.Count; i++)
            {
                foundOne = true;
                Username = Blocks.Rows[i]["Username"].ToString();
                TimePerformed = DateTime.Parse(Blocks.Rows[i]["TimePerformed"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                //Server.s.Log(Blocks.Rows[i]["Type"].ToString());
                BlockUsed = Block.Name(Convert.ToByte(Blocks.Rows[i]["Type"])).ToString();
                Deleted = Convert.ToBoolean(Blocks.Rows[i]["Deleted"]);

                if (!Deleted)
                    Player.SendMessage(p, "&3Created by " + Server.FindColor(Username.Trim()) + Username.Trim() + Server.DefaultColor + ", using &3" + BlockUsed);
                else
                    Player.SendMessage(p, "&4Destroyed by " + Server.FindColor(Username.Trim()) + Username.Trim() + Server.DefaultColor + ", using &3" + BlockUsed);
                Player.SendMessage(p, "Date and time modified: &2" + TimePerformed);
            }

            List<Level.BlockPos> inCache = p.level.blockCache.FindAll(bP => bP.x == x && bP.y == y && bP.z == z);

            for (int i = 0; i < inCache.Count; i++)
            {
                foundOne = true;
                Deleted = inCache[i].deleted;
                Username = inCache[i].name;
                TimePerformed = inCache[i].TimePerformed.ToString("yyyy-MM-dd HH:mm:ss");
                BlockUsed = Block.Name(inCache[i].type);

                if (!Deleted)
                    Player.SendMessage(p, "&3Created by " + Server.FindColor(Username.Trim()) + Username.Trim() + Server.DefaultColor + ", using &3" + BlockUsed);
                else
                    Player.SendMessage(p, "&4Destroyed by " + Server.FindColor(Username.Trim()) + Username.Trim() + Server.DefaultColor + ", using &3" + BlockUsed);
                Player.SendMessage(p, "Date and time modified: &2" + TimePerformed);
            }

            if (!foundOne)
                Player.SendMessage(p, "This block has not been modified since the map was cleared.");

            Blocks.Dispose();

            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
开发者ID:Arrem,项目名称:MCForge-MCLawl,代码行数:59,代码来源:CmdAbout.cs


注:本文中的Player.ClearBlockchange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。