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


C# Player.HandleDeath方法代码示例

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


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

示例1: Use

        public override void Use(Player p, string message)
        {
            if (message == "") { Help(p); return; }

            Player who; string killMsg; int killMethod = 0;
            if (message.IndexOf(' ') == -1)
            {
                who = Player.Find(message);
                if (p != null)
                {
                    killMsg = " was killed by " + p.color + p.name;
                }
                else
                {
                    killMsg = " was killed by " + "the Console.";
                }
            }
            else
            {
                who = Player.Find(message.Split(' ')[0]);
                message = message.Substring(message.IndexOf(' ') + 1);

                if (message.IndexOf(' ') == -1)
                {
                    if (message.ToLower() == "explode")
                    {
                        if (p != null)
                        {
                            killMsg = " was exploded by " + p.color + p.name;
                        }
                        else
                        {
                            killMsg = " was exploded by the Console.";
                        }
                        killMethod = 1;
                    }
                    else
                    {
                        killMsg = " " + message;
                    }
                }
                else
                {
                    if (message.Split(' ')[0].ToLower() == "explode")
                    {
                        killMethod = 1;
                        message = message.Substring(message.IndexOf(' ') + 1);
                    }

                    killMsg = " " + message;
                }
            }

            if (who == null)
            {
                if (p != null)
                {
                    p.HandleDeath(Block.rock, " killed itself in its confusion");
                }
                Player.SendMessage(p, "Could not find player");
                return;
            }

            if (p != null)
            {
                if (who.group.Permission > p.group.Permission)
                {
                    p.HandleDeath(Block.rock, " was killed by " + who.color + who.name);
                    Player.SendMessage(p, "Cannot kill someone of higher rank");
                    return;
                }
            }

            if (killMethod == 1)
                who.HandleDeath(Block.rock, killMsg, true);
            else
                who.HandleDeath(Block.rock, killMsg);
        }
开发者ID:Jack13122,项目名称:MCForge-Vanilla,代码行数:78,代码来源:CmdKill.cs


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