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


C# Player.SetDatapass方法代码示例

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


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

示例1: Use

        public void Use(Player p, string[] args) {
            CatchPos cpos = new CatchPos();
            if (args.Length != 0) {
                cpos.ignore = new List<byte>();
                for (int i = 0; i < args.Length; i++) {
                    try {
                        cpos.ignore.Add(Block.NameToBlock(args[i]));
                    }
                    catch {
                        p.SendMessage("Could not find the block '" + args[i] + "'");
                        return;
                    }
                }
                string s = "";
                for (int i = 0; i < cpos.ignore.Count; i++) {
                    s += ((Block)cpos.ignore[i]).Name;
                    if (i == cpos.ignore.Count - 2) s += " and ";
                    else if (i != cpos.ignore.Count - 1) s += ", ";
                }
                p.SendMessage("Ignoring " + s + ".");
            }
            //else
            //cpos.ignore.Add(Block.NameToByte("unknown")); //So it doesn't ignore air.
            p.SendMessage("Place two blocks to determine the edges.");
            //p.CatchNextBlockchange(new Player.BlockChangeDelegate(CatchBlock), (object)cpos);
            p.SetDatapass("CmdMeasure_cpos", cpos);
            p.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock);

        }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:29,代码来源:CmdMeasure.cs

示例2: BlockChange1

 void BlockChange1(Player sender, BlockChangeEventArgs args) {
     CatchPos cpos = (CatchPos)sender.GetDatapass(Name);
     cpos.pos = new Vector3S((short)args.X, (short)args.Z, (short)args.Y);
     args.Cancel();
     sender.OnPlayerBlockChange.Normal -= BlockChange1;
     sender.SetDatapass(Name, cpos);
     sender.OnPlayerBlockChange.Normal += BlockChange2;
 }
开发者ID:nullpic,项目名称:MCForge-Vanilla,代码行数:8,代码来源:CmdWrite.cs

示例3: Use

 public void Use(Player p, string[] args) {
     if (args.Length == 0) { p.SendMessage("Please specify a message to write!"); Help(p); return; }
     CatchPos cpos = new CatchPos();
     cpos.message = string.Join(" ", args);
     p.SetDatapass(Name, cpos);
     p.SendMessage("Place two blocks to determine the direction!");
     p.OnPlayerBlockChange.Normal += BlockChange1;
 }
开发者ID:nullpic,项目名称:MCForge-Vanilla,代码行数:8,代码来源:CmdWrite.cs

示例4: CatchBlock

 public void CatchBlock(Player sender, BlockChangeEventArgs args)
 {
     args.Unregister();
     Vector3S FirstBlock = new Vector3S(args.X, args.Z, args.Y);
     sender.SendMessage("Please place another block...");
     sender.SetDatapass("CmdDatapassExample_FirstBlock", FirstBlock);
     sender.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock2);
 }
开发者ID:Maicke98,项目名称:MCForge-Vanilla,代码行数:8,代码来源:CmdDatapassExample.cs

示例5: CatchBlock1

 public void CatchBlock1(Player p, BlockChangeEventArgs args)
 {
     CatchPos cpos = (CatchPos)p.GetDatapass(this.Name);
     cpos.pos = new Vector3S(args.X, args.Z, args.Y);
     args.Cancel();
     p.OnPlayerBlockChange.Normal -= new Event<Player, BlockChangeEventArgs>.EventHandler(CatchBlock1);
     p.SetDatapass(this.Name, cpos);
     p.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock2);
 }
开发者ID:headdetect,项目名称:MCForge6-Vanilla,代码行数:9,代码来源:CmdReplace.cs

示例6: CatchBlock

 //public void CatchBlock(Player p, ushort x, ushort z, ushort y, byte NewType, bool placed, object DataPass)
 public void CatchBlock(Player sender, BlockChangeEventArgs args)
 {
     CatchPos cpos = (CatchPos)sender.GetDatapass("CmdReplaceNot_cpos");
     cpos.pos = new Vector3S(args.X, args.Z, args.Y);
     args.Unregister();
     sender.SetDatapass("CmdReplaceNot_cpos", cpos);
     sender.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock2);
     //p.CatchNextBlockchange(CatchBlock2, (object)cpos);
 }
开发者ID:Maicke98,项目名称:MCForge-Vanilla,代码行数:10,代码来源:CmdReplaceNot.cs

示例7: CatchBlock

 public void CatchBlock(Player sender, BlockChangeEventArgs args)
 {
     CatchPos cpos = (CatchPos)sender.GetDatapass("CmdReplace_cpos"); ;
     cpos.pos = new Vector3S(args.X, args.Y, args.Z);
     args.Unregister();
     args.Cancel();
     sender.SetDatapass("CmdReplace_cpos", cpos);
     sender.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock2);
 }
开发者ID:Maicke98,项目名称:MCForge-Vanilla,代码行数:9,代码来源:CmdReplace.cs

示例8: CatchBlock

 //public void CatchBlock(Player p, ushort x, ushort z, ushort y, byte NewType, bool placed, object DataPass)
 public void CatchBlock(Player sender, BlockChangeEventArgs args) {
     args.Cancel();
     args.Unregister();
     sender.SendBlockChange(args.X, args.Z, args.Y, sender.Level.GetBlock(args.X, args.Z, args.Y));
     CatchPos cpos = (CatchPos)sender.GetDatapass("CmdMeasure_cpos");
     cpos.FirstBlock = new Vector3S(args.X, args.Z, args.Y);
     sender.SetDatapass("CmdMeasure_cpos", cpos);
     sender.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock2);
     //p.CatchNextBlockchange(new Player.BlockChangeDelegate(CatchBlock2), (object)cpos);
 }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:11,代码来源:CmdMeasure.cs

示例9: Use

        public void Use(Player p, string[] args)
        {
            if (args.Length != 2)
            {
                p.SendMessage("Invalid number of arguments!");
                Help(p);
                return;
            }

            CatchPos cpos = new CatchPos();
            List<string> oldType;

            if (args[0].Contains(","))
                oldType = new List<string>(args[0].Split(','));
            else
                oldType = new List<string>() { args[0] };
            
            oldType = oldType.Distinct().ToList(); // Remove duplicates

            List<string> invalid = new List<string>(); //Check for invalid blocks
            foreach (string name in oldType)
                if (!Block.ValidBlockName(name))
                    invalid.Add(name);
            if (!Block.ValidBlockName(args[1]))
                invalid.Add(args[1]);
            if (invalid.Count > 0)
            {
                p.SendMessage(String.Format("Invalid block{0}: {1}", invalid.Count == 1 ? "" : "s", String.Join(", ", invalid)));
                return;
            }

            if (oldType.Contains(args[1]))
                oldType.Remove(args[1]);
            if (oldType.Count < 1)
            {
                p.SendMessage("Replacing a block with the same one would be pointless!");
                return;
            }

            cpos.oldType = new List<byte>();
            foreach (string name in oldType)
                cpos.oldType.Add(Block.NameToBlock(name));
            cpos.newType = Block.NameToBlock(args[1]);

            p.SendMessage("Place two blocks to determine the edges.");
            p.SetDatapass(this.Name, cpos);
            p.OnPlayerBlockChange.Normal += new Event<Player, BlockChangeEventArgs>.EventHandler(CatchBlock1);
        }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:48,代码来源:CmdReplace.cs

示例10: Use

        public void Use(Player p, string[] args) {
            Level l = args.Length != 0
                ? Level.Levels.Find(lev => { return lev.Name.IndexOf(String.Join(" ", args)) != -1; })
                : p.Level;
            if (l == null) { p.SendMessage("Could not find specified level."); return; }

            p.SendMessage(String.Concat(Colors.yellow, "Map Name: ", Colors.white, l.Name));
            p.SendMessage(String.Concat(Colors.yellow, "Map Size: ", Colors.white, l.Size));
            p.SendMessage(String.Concat(Colors.yellow, "Total Blocks: ", Colors.white, l.TotalBlocks));
            p.SendMessage(String.Concat(Colors.yellow, "Spawn Pos: ", Colors.white, l.SpawnPos));
            p.SendMessage(String.Concat(Colors.yellow, "Physics Tick: ", Colors.white, l.PhysicsTick));
            p.SendMessage(String.Concat("To see a list of players currently on ", l.Name, ", type \"yes\"."));
            //OnPlayerChat.Register(plist, MCForge.API.Priority.Normal, l, p);
            p.OnPlayerChat.Normal += new ChatEvent.EventHandler(plist);
            p.SetDatapass("mapinfoLevel", l);
        }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:16,代码来源:CmdMapInfo.cs

示例11: Use

 public void Use(Player p, string[] args) {
     if (p.Group.Permission < Permission) {
         p.SendMessage("You're not allowed to use /mb");
         return;
     }
     PluginMessageBlock pmb = (PluginMessageBlock)Plugin.getByType(typeof(PluginMessageBlock).Name);
     if (pmb == null) {
         p.SendMessage(typeof(PluginMessageBlock).Name + " is currently not loaded");
         return;
     }
     if (args.Length > 0) {
         if (args[0] == "+") {
             if (args.Length == 1) {
                 Help(p);
                 return;
             }
             if (args.Length == 2) {
                 if (args[1] == "view") {
                     if (p.Group.Permission < viewPermission) {
                         p.SendMessage("Your are not allowed to use /mb + view");
                         return;
                     }
                     string[] ov = pmb.GetOverview(p.Level);
                     for (int i = 0; i < ov.Length; i++) {
                         p.SendMessage(ov[i]);
                     }
                     return;
                 }
                 else if (args[1] == "remove") {
                     if (p.Group.Permission < createPermission) {
                         p.SendMessage("Your are not allowed to use /mb + remove");
                         return;
                     }
                     p.OnPlayerBlockChange.Normal += remove_Normal;
                     return;
                 }
             }
             else if (args.Length == 3 && args[1] == "remove") {
                 if (args[2] == "all") {
                     if (p.Group.Permission < removeAllPermission) {
                         p.SendMessage("You're not allowed to use /mb + all");
                         return;
                     }
                     int count = pmb.RemoveAll(p.Level);
                     p.SendMessage(count + " message block" + (count == 1 ? "" : "s") + " removed");
                     return;
                 }
             }
             else if (args.Length > 5) {
                 ushort x, z, y;
                 try {
                     x = ushort.Parse(args[1]);
                     z = ushort.Parse(args[2]);
                     y = ushort.Parse(args[3]);
                 }
                 catch {
                     p.SendMessage("Location could not be parsed");
                     return;
                 }
                 Level l = Level.FindLevel(args[4]);
                 if (l == null) {
                     p.SendMessage("Level is not loaded or does not exist");
                     return;
                 }
                 string message = String.Join(" ", args, 5, args.Length - 5);
                 add(l, x, z, y, message, p);
                 return;
             }
             Help(p);
             return;
         }
         else {
             string message = String.Join(" ", args);
             p.SetDatapass("MessageBlockMessage", message);
             p.OnPlayerBlockChange.Normal += add_Normal;
         }
     }
 }
开发者ID:nullpic,项目名称:MCForge-Vanilla,代码行数:78,代码来源:PluginMessageBlock.cs

示例12: Use

        public void Use(Player p, string[] args)
        {
            byte type = 0;
            byte type2 = 0;
            if (args.Length != 2) {
                p.SendMessage("Invalid arguments!");
                Help(p);
                return;
            }
            if (!Block.ValidBlockName(args[0 | 1])) {
                p.SendMessage("Could not find block specified");
            }

            //Block permissions here.
            CatchPos cpos = new CatchPos();
            cpos.type = type;
            cpos.type2 = type2;

            p.SendMessage("Place two blocks to determine the edges.");
            p.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock);
            p.SetDatapass("CmdReplaceNot_cpos", cpos);
            //p.CatchNextBlockchange(new Player.BlockChangeDelegate(CatchBlock), (object)cpos);
        }
开发者ID:Maicke98,项目名称:MCForge-Vanilla,代码行数:23,代码来源:CmdReplaceNot.cs

示例13: Use

        public void Use(Player p, string[] args)
        {
            if (args.Length != 2)
            {
                p.SendMessage("Invalid number of arguments!");
                Help(p);
                return;
            }

            CatchPos cpos = new CatchPos();
            List<string> ignore;

            if (args[0].Contains(","))
                ignore = new List<string>(args[0].Split(','));
            else
                ignore = new List<string>() { args[0] };

            ignore = ignore.Distinct().ToList(); // Remove duplicates

            List<string> invalid = new List<string>(); //Check for invalid blocks
            foreach (string name in ignore)
                if (!Block.ValidBlockName(name))
                    invalid.Add(name);
            if (!Block.ValidBlockName(args[1]))
                invalid.Add(args[1]);
            if (invalid.Count > 0)
            {
                p.SendMessage(String.Format("Invalid block{0}: {1}", invalid.Count == 1 ? "" : "s", String.Join(", ", invalid)));
                return;
            }

            if (ignore.Contains(args[1]))
                ignore.Remove(args[1]);
            if (ignore.Count < 1)
                p.SendMessage("Next time, just use cuboid if you're not going to ignore anything!");

            cpos.ignore = new List<byte>();
            foreach (string name in ignore)
                cpos.ignore.Add(Block.NameToBlock(name));
            cpos.newType = Block.NameToBlock(args[1]);

            p.SendMessage("Place two blocks to determine the edges.");
            p.SetDatapass(this.Name, cpos);
            p.OnPlayerBlockChange.Normal += new Event<Player, BlockChangeEventArgs>.EventHandler(CatchBlock1);
        }
开发者ID:headdetect,项目名称:MCForge6-Vanilla,代码行数:45,代码来源:CmdReplaceNot.cs


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