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


C# Player.SendToPos方法代码示例

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


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

示例1: Use

 public void Use(Player p, string[] args)
 {
     if (args.Count() != 0)
     {
         Help(p);
         return;
     }
     Vector3 meep = new Vector3((short)(p.Level.SpawnPos.x * 32), (short)(p.Level.SpawnPos.z * 32 + 51), (short)(p.Level.SpawnPos.y * 32));
     p.SendToPos(meep, p.Level.SpawnRot);
 }
开发者ID:timawesomeness,项目名称:MCForge-Vanilla,代码行数:10,代码来源:CmdSpawn.cs

示例2: Use

 public void Use(Player p, string[] args)
 {
     List<Block> blocks = new List<Block>(new Block[] { Block.BlockList.AIR, Block.BlockList.RED_MUSHROOM, Block.BlockList.BROWN_MUSHROOM, Block.BlockList.RED_FLOWER, Block.BlockList.YELLOW_FLOWER, Block.BlockList.ACTIVE_LAVA, Block.BlockList.ACTIVE_WATER, Block.BlockList.WATER, Block.BlockList.LAVA });
     ushort x = (ushort)(p.Pos.x / 32), z = (ushort)(p.Pos.z / 32), y = (ushort)((p.Pos.y / 32) - 1);
     bool tpd = false;
     while (y > 0) { y--;
         if (p.Level.GetBlock(x, z, y) == Block.BlockList.AIR && p.Level.GetBlock(x, z, (ushort)(y + 1)) == Block.BlockList.AIR && !blocks.Contains(p.Level.GetBlock(x, z, (ushort)(y - 1)))) {
             try { p.SendToPos(new Vector3S((ushort)(p.Pos.x), (ushort)(p.Pos.z), (ushort)((y + 1) * 32))); }
             catch { p.SendMessage("Error while trying to descend!"); return; }
             p.SendMessage("You have descended!"); tpd = true;
             break;
         }
     }
     if (!tpd) { p.SendMessage("No free spaces found below you!"); }
 }
开发者ID:headdetect,项目名称:MCForge6-Vanilla,代码行数:15,代码来源:CmdDescend.cs

示例3: Use

 public void Use(Player p, string[] args)
 {
     List<Block> blocks = new List<Block>(new Block[] { Block.BlockList.AIR, Block.BlockList.RED_MUSHROOM, Block.BlockList.BROWN_MUSHROOM, Block.BlockList.RED_FLOWER, Block.BlockList.YELLOW_FLOWER, Block.BlockList.ACTIVE_LAVA, Block.BlockList.ACTIVE_WATER, Block.BlockList.WATER, Block.BlockList.LAVA });
     ushort top = (ushort)(p.Level.Size.y), x = (ushort)(p.Pos.x / 32), y = (ushort)(p.Pos.y / 32), z = (ushort)(p.Pos.z / 32); ;
     bool tpd = false;
     while (y < top) { y++;
         if (p.Level.GetBlock(x, z, y) == Block.BlockList.AIR && p.Level.GetBlock(x, z, (ushort)(y + 1)) == Block.BlockList.AIR && !blocks.Contains(p.Level.GetBlock(x, z, (ushort)(y - 1)))) {
             try { p.SendToPos(new Vector3((ushort)(p.Pos.x), (ushort)(p.Pos.z), (ushort)((y + 1) * 32)), p.Rot); }
             catch { p.SendMessage("An error has occured while trying to ascend!"); return; }
             p.SendMessage("You have ascended!"); tpd = true;
             break;
         }
     }
     if (!tpd) { p.SendMessage("No free spaces found above you!"); }
 }
开发者ID:timawesomeness,项目名称:MCForge-Vanilla,代码行数:15,代码来源:CmdAscend.cs

示例4: Use

        public void Use(Player p, string[] args)
        {
            PlayerGroup wanted = null;
            if (args.Count() == 1)
            {
                wanted = PlayerGroup.Find(args[0].ToLower()); // will be null if none found.
                if (wanted == null)
                    p.SendMessage("Spcified group doesn't exist.  Using all groups below you...");
            }
            if (wanted != null && wanted.Permission >= p.Group.Permission)
            {
                wanted = null;
                p.SendMessage("Sorry, you can only patrol groups of a lower rank.  Using all groups below you...");
            }
            p.SendMessage("Finding a person " + (wanted == null ? "under you" : "of the specified rank") + " to patrol...");
            ICommand gotoCmd = Command.Find("goto"); //If goto exists, we can use it to go to the new level before teleporting.
            List<Player> allUnder = Server.Players.FindAll(plr => (wanted == null ? true : plr.Group.Permission == wanted.Permission) && plr.Group.Permission < p.Group.Permission && (gotoCmd == null ? p.Level == plr.Level : true));
            if (allUnder.Count == 0)
            {
                p.SendMessage("There are no people " + (wanted == null ? "under your" : "of the specified") + " rank that are " + (gotoCmd == null ? "in your level." : "currently online."));
                return;
            }
            Player found = allUnder[(new Random()).Next(allUnder.Count)];
            p.SendMessage("Player found!  Transporting you to " + found.Color + found.Username + Server.DefaultColor + "!");
            if (p.Level != found.Level)
            {
                //Go to the level first
                gotoCmd.Use(p, new string[] { found.Level.Name });
            }
            if (found.IsLoading)
            {
                p.SendMessage("Waiting for " + found.Color + found.Username + Server.DefaultColor + " to spawn...");

                while (found.IsLoading) { 
                    Thread.Sleep(5);
                } // until event works
            }
            while (p.IsLoading) {
                Thread.Sleep(5);
            } // until event works.
            p.SendToPos(found.Pos, found.Rot);
        }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:42,代码来源:CmdPatrol.cs

示例5: sendToTeamSpawn

 public void sendToTeamSpawn(Player p)
 {
     if (!GameInProgess()) return;
     ushort x, y, z; int xx, yy, zz;
     x = (ushort)((int)p.Pos.x / 32);
     y = (ushort)((int)p.Pos.z / 32 - 1);
     z = (ushort)((int)p.Pos.y / 32);
     xx = p.Pos.x;
     yy = p.Pos.z;
     zz = p.Pos.y;
     if ((int)p.ExtraData["team"] == 2)
     {
         p.SendToPos(redSpawn);
     }
     else
     {
         p.SendToPos(blueSpawn);
     }
     Thread dropThread = new Thread(new ThreadStart(delegate
     {
         Thread.Sleep(500);
         dropFlag(p, x, y, z, xx, yy, zz);
     }));
     dropThread.Start();
 }
开发者ID:headdetect,项目名称:MCForge6-Vanilla,代码行数:25,代码来源:CTF.cs

示例6: Use

        public void Use(Player p, string[] args)
        {
            if (args.Length > 2)
            {
                p.SendMessage("Invalid arguments!");
                return;
            }
            else if (args.Length == 0)
            {
                Vector3 meep = new Vector3((short)(0.5 + p.Level.SpawnPos.x * 32), (short)(0.5 + p.Level.SpawnPos.z * 32), (short)(1 + p.Level.SpawnPos.y * 32));
                p.SendToPos(meep, p.Level.SpawnRot);
            }
            else if (args.Length == 1)
            {
                Player who = Player.Find(args[0]);
                if (who == null || who.IsHidden)
                {
                    p.SendMessage("Player: " + args[0] + " not found!");
                    return;
                }
                else if (who == p)
                {
                    p.SendMessage("Why are you trying to teleport yourself to yourself?");
                    return;
                }
                else if (!ServerSettings.GetSettingBoolean("AllowHigherRankTp") && p.group.permission < who.group.permission)
                {
                    p.SendMessage("You cannot teleport to a player of higher rank!");
                    return;
                }
                else
                {
                    if (p.Level != who.Level)
                    {
                        //Need goto here
                        if (who.IsLoading)
                        {
                            p.SendMessage("Waiting for " + (string)who.ExtraData.GetIfExist("Color") + who.Username + Server.DefaultColor + " to spawn...");
                            while (who.IsLoading)
                                Thread.Sleep(5);

                        }
                    }
                }
                p.SendToPos(who.Pos, who.Rot);
                return;
            }
            else
            {
                Player one = Player.Find(args[0]);
                Player two = Player.Find(args[1]);
                if (one == null || two == null)
                {
                    //Hehe
                    p.SendMessage((one == null && two == null) ? "Players: " + args[0] + " and " + args[1] + " not found!" : "Player: " + ((one == null) ? args[0] : args[1]) + " not found!");
                    return;
                }
                else if (one == p && two == p || one == p)
                {
                    p.SendMessage((two == p) ? "Why are you trying to teleport yourself to yourself?" : "Why not just use /tp " + args[1] + "?");
                    return;
                }
                else if (two == p)
                {
                    p.SendMessage("Why not just use /summon " + args[0] + "?");
                    return;
                }
                else if (p.group.permission < one.group.permission)
                {
                    p.SendMessage("You cannot force a player of higher rank to tp to another player!");
                }
                else
                {
                    if (one.Level != two.Level)
                    {
                        //Need goto here
                        if (two.IsLoading)
                        {
                            p.SendMessage("Waiting for " + (string)two.ExtraData.GetIfExist("Color") + two.Username + Server.DefaultColor + " to spawn...");
                            while (two.IsLoading) {
                                Thread.Sleep(5);
                            }
                        }
                    }
                }
                one.SendToPos(two.Pos, two.Rot);
                p.SendMessage(one.Username + " has been succesfully teleported to " + two.Username + "!");
                return;
            }
        }
开发者ID:timawesomeness,项目名称:MCForge-Vanilla,代码行数:90,代码来源:CmdTeleport.cs

示例7: OnMove

        public void OnMove(Player Player, MoveEventArgs args)
        {
            try
            {
                if (Player.Group.Permission < ServerSettings.GetSettingInt("WOMPermission") &&
                    !WomExempt.Contains(Player.Username.ToLower()))
                {
                    if ((bool) (Player.ExtraData.GetIfExist("UsingWoM")) && !Player.IsBeingKicked)
                    {
                        Player.Kick("WoM is not allowed on this server!");
                        args.Cancel();
                    }
                }

            ExtraPlayerData temp = FindPlayer(Player);
            if (temp == null)
                return;
            if (!temp.SentUserType)
            {
                temp.SentUserType = true;
                ZombieHelper.SendUserType(temp);
            }

            #region Anti-Hack
            Vector3S delta = new Vector3S((short)Math.Abs(Player.Pos.x - Player.oldPos.x),
                (short)Math.Abs(Player.Pos.z - Player.oldPos.z),
                (short)Math.Abs(Player.Pos.y - Player.oldPos.y));

            Vector3S delta32 = new Vector3S((short)(Math.Abs(Player.Pos.x - Player.oldPos.x) / 32),
                (short)(Math.Abs(Player.Pos.z - Player.oldPos.z) / 32),
                (short)(Math.Abs(Player.Pos.y - Player.oldPos.y) / 32));

            bool posChanged = ( delta.x != 0 ) || ( delta.y != 0 ) || ( delta.z != 0 );
            bool pos32Changed = (delta.x != 0) || (delta.y != 0) || (delta.z != 0);
            // skip everything if player hasn't moved
            if (!posChanged) return;
            if (!temp.Referee && !temp.Player.IsLoading && !temp.Player.IsBot)
            {
                if (delta.x >= 160) //Allows 5 blocks a second... more than enough with lag
                {
                    if (temp.Spawning == false)
                    {
                        temp.Spawning = true;
                        Player.SendToPos(Player.oldPos);
                        return;
                    }
                }
                else if (delta.z >= 160) //Allows 5 blocks a second... more than enough with lag
                {
                    if (temp.Spawning == false)
                    {
                        temp.Spawning = true;
                        Player.SendToPos(Player.oldPos);
                        return;
                    }
                }
                else if (temp.Spawning == true)
                {
                    temp.Spawning = TriBool.Unknown;
                }
                else if (temp.Spawning == TriBool.Unknown)
                {
                    temp.Spawning = false;
                }

                try
                {
                    if (Player.Pos.y > 64 && !temp.Referee && (Player.Pos.y / 32) < Player.Level.CWMap.Size.y)
                    {
                        if (Block.CanWalkThrough(Player.Level.GetBlock((Player.Pos.x / 32), (Player.Pos.z / 32), (Player.Pos.y / 32) - 2)) &&
                            Block.CanWalkThrough(Player.Level.GetBlock((Player.Pos.x / 32), (Player.Pos.z / 32), (Player.Pos.y / 32) - 3)) &&
                            !Block.CanEscalate(Player.Level.GetBlock((Player.Pos.x / 32), (Player.Pos.z / 32), (Player.Pos.y / 32) - 2)) &&
                            !Block.CanEscalate(Player.Level.GetBlock((Player.Pos.x / 32), (Player.Pos.z / 32), (Player.Pos.y / 32) - 1)) &&
                            !Block.CanEscalate(Player.Level.GetBlock(Player.Pos / 32)))
                        {
                            if ((Player.Pos.y / 32) - (args.FromPosition.y / 32) == 0)
                            {
                                temp.AmountOfTimesInAir++;
                                if (temp.AmountOfTimesInAir == AmountOfChecksInAir)
                                {
                                    temp.Player.Kick("You are not allowed to fly on this server!");
                                    args.Cancel();
                                    return;
                                }
                            }
                            if ((Player.Pos.y / 32) - (args.FromPosition.y / 32) == -1)
                            {
                                temp.AmountOfTimesInAir--;
                            }
                        }
                        else
                        {
                            temp.AmountOfTimesInAir = 0;
                        }
                    }
                    else
                    {
                        temp.AmountOfTimesInAir = 0;
                    }
                }
//.........这里部分代码省略.........
开发者ID:headdetect,项目名称:MCForge6-Vanilla,代码行数:101,代码来源:ZombiePlugin.cs

示例8: Use

        public void Use(Player p, string[] args)
        {
            switch (args.Length)
            {
                case 0:
                    Vector3S meep = new Vector3S((short)(p.Level.CWMap.SpawnPos.x * 32 + 16), (short)(p.Level.CWMap.SpawnPos.z * 32 + 16), (short)(p.Level.CWMap.SpawnPos.y * 32));
                    p.SendToPos(meep, new byte[2] { (byte)p.Rot.x, (byte)p.Rot.z });
                    break;
                case 1:
                    Player who = Player.Find(args[0]);
                    if (who == null || who.IsHidden)
                    {
                        p.SendMessage("Player: " + args[0] + " not found!");
                        return;
                    }
                    else if (who == p)
                    {
                        p.SendMessage("Why are you trying to teleport yourself to yourself?");
                        return;
                    }
                    else if (!ServerSettings.GetSettingBoolean("AllowHigherRankTp") && p.Group.Permission < who.Group.Permission)
                    {
                        p.SendMessage("You cannot teleport to a player of higher rank!");
                        return;
                    }
                    else
                    {
                        if (p.Level != who.Level)
                        {
                            //Need goto here
                            if (who.IsLoading)
                            {
                                p.SendMessage("Waiting for " + who.Color + who.Username + Server.DefaultColor + " to spawn...");
                                while (who.IsLoading)
                                    Thread.Sleep(5);

                            }
                        }
                    }
                    p.SendToPos(who.Pos, new byte[2] { (byte)who.Rot.x, (byte)who.Rot.z });
                    break;
                case 2:
                    Player one = Player.Find(args[0]);
                    Player two = Player.Find(args[1]);
                    if (one == null || two == null)
                    {
                        //Hehe
                        p.SendMessage((one == null && two == null) ? "Players: " + args[0] + " and " + args[1] + " not found!" : "Player: " + ((one == null) ? args[0] : args[1]) + " not found!");
                        return;
                    }
                    else if (one == p && two == p || one == p)
                    {
                        p.SendMessage((two == p) ? "Why are you trying to teleport yourself to yourself?" : "Why not just use /tp " + args[1] + "?");
                        return;
                    }
                    else if (two == p)
                    {
                        p.SendMessage("Why not just use /summon " + args[0] + "?");
                        return;
                    }
                    else if (p.Group.Permission < one.Group.Permission)
                    {
                        p.SendMessage("You cannot force a player of higher rank to tp to another player!");
                    }
                    else
                    {
                        if (one.Level != two.Level)
                        {
                            //Need goto here
                            if (two.IsLoading)
                            {
                                p.SendMessage("Waiting for " + two.Color + two.Username + Server.DefaultColor + " to spawn...");
                                while (two.IsLoading)
                                {
                                    Thread.Sleep(5);
                                }
                            }
                        }
                    }
                    one.SendToPos(two.Pos);
                    p.SendMessage(one.Username + " has been succesfully teleported to " + two.Username + "!");
                    break;
                case 3: {
                        short x, z, y;
                        bool[] intParse = { short.TryParse(args[0], out x), short.TryParse(args[1], out z), short.TryParse(args[2], out y) };
                        if (intParse.Contains<bool>(false)) {
                            p.SendMessage("One of your coordinates was har.");
                            return;
                        }
                        else {
                            p.SendToPos(new Vector3S(x, z, y), new byte[2] { (byte)p.Rot.x, (byte)p.Rot.z });
                            p.SendMessage(string.Format("Succesfully teleported to {0}, {1}, {2}!", x, z, y));
                        }
                        break;
                    }
                case 4: {
                        short x, z, y;
                        bool[] intParse = { short.TryParse(args[0], out x), short.TryParse(args[1], out z), short.TryParse(args[2], out y) };
                        if (intParse.Contains<bool>(false)) {
                            p.SendMessage("One of your coordinates was har.");
//.........这里部分代码省略.........
开发者ID:headdetect,项目名称:MCForge6-Vanilla,代码行数:101,代码来源:CmdTeleport.cs


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