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


C# Player.SendDirectedMessage方法代码示例

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


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

示例1: Run

 public override void Run(Player ply, string[] cmdparts)
 {
     if (cmdparts.Length <= 1)
     {
         string str = "";
         foreach (Player plyn in Program.minecraftFirewall.players)
         {
             if (plyn.name == null || plyn.name == "") continue;
             str += plyn.name + ", ";
         }
         ply.SendDirectedMessage("Connected players: " + ((str.Length > 2) ? str.Remove(str.Length - 2) : "None"));
     }
     else
     {
         Player ply2 = Program.minecraftFirewall.FindPlayer(cmdparts[1]);
         if (ply2 == null) { ply.SendDirectedMessage("Sorry, player could not be found!"); return; }
         ply.SendDirectedMessage("Name: " + ply2.name);
         ply.SendDirectedMessage("Rank: " + ply2.GetRank());
         string plyn = ply2.name.ToLower();
         if (ply.GetLevel() >= 3)
         {
             ply.SendDirectedMessage("IP: " + ply2.ip);
         }
     }
 }
开发者ID:astory,项目名称:MCAdmin,代码行数:25,代码来源:WhoCommand.cs

示例2: Run

 public override void Run(Player ply, string[] cmdparts)
 {
     switch (cmdparts[1])
     {
         case "do":
             Program.tmBackup_Tick(null);
             ply.SendDirectedMessage("Backup initiated!");
             break;
         case "list":
             ply.SendDirectedMessage("Available backups for this world:");
             foreach (string str in Directory.GetFiles("backups", Program.GetServerProperty("level-name", "world") + "_*.zip"))
             {
                 ply.SendDirectedMessage(str.Substring(8,str.Length - 12));
             }
             break;
         case "restore":
             string strf = "backups/" + cmdparts[2] + ".zip";
             if (!File.Exists(strf)) ply.SendDirectedMessage("File not found!");
             else if (Program.isStuffInProgress) ply.SendDirectedMessage("Sorry, restore in progress!");
             else
             {
                 Program.isStuffInProgress = true;
                 Program.SendServerMessage("Initiated backup restore. Prepare for disconnect!");
                 Thread.Sleep(1000);
                 new Thread(new ParameterizedThreadStart(RestoreThread)).Start(strf);
             }
             break;
         default:
             throw new InvalidOperationException();
     }
 }
开发者ID:astory,项目名称:MCAdmin,代码行数:31,代码来源:BackupCommand.cs

示例3: Run

 public override void Run(Player ply, string[] cmdparts)
 {
     ply.SendDirectedMessage("§9MCAdmin (c) 2010");
     ply.SendDirectedMessage("§eBy Doridian the Blue Haired Fox");
     ply.SendDirectedMessage("");
     ply.SendDirectedMessage("§eReleased under the terms of the BSD License");
 }
开发者ID:astory,项目名称:MCAdmin,代码行数:7,代码来源:VersionCommand.cs

示例4: Run

        public override void Run(Player ply, string[] cmdparts)
        {
            if (ply.GetLevel() < Program.PlyGetLevel(cmdparts[1])) { ply.SendPermissionDenied(); return; }

            Player ply2 = Program.minecraftFirewall.FindPlayer(cmdparts[1]);
            if (ply2 == null)
            {
                ply.SendDirectedMessage("No player found!");
                return;
            }

            string reasonstr = ""; string reason = "";
            if (cmdparts.Length > 2)
            {
                for (int i = 2; i < cmdparts.Length; i++)
                {
                    reason += cmdparts[i] + " ";
                }
                reason = reason.Remove(reason.Length - 1).Trim();
                reasonstr = " (" + reason + ")";
            }

            ply2.Disconnect("Kicked by " + ply.name + reasonstr);
            Program.SendServerMessage(ply.name + " kicked " + ply2.name + reasonstr);

            if (Program.PlyIsDev(cmdparts[1])) ply.SendDirectedMessage("§4You just kicked an Official MCAdmin Developer!");
        }
开发者ID:astory,项目名称:MCAdmin,代码行数:27,代码来源:KickCommand.cs

示例5: Run

 public override void Run(Player ply, string[] cmdparts)
 {
     ply.SendDirectedMessage("§9MCAdmin (c) 2010");
     ply.SendDirectedMessage("§a- §bDoridian: §fFounder & Main Blue Haired Fox Developer");
     ply.SendDirectedMessage("§a- §bToxicated: §fCombine Soldier Developer");
     ply.SendDirectedMessage("");
     ply.SendDirectedMessage("§eMCAdmin is released under the §cBSD License§e.");
 }
开发者ID:astory,项目名称:MCAdmin,代码行数:8,代码来源:CreditsCommand.cs

示例6: Run

 public override void Run(Player ply, string[] cmdparts)
 {
     switch (cmdparts[1].ToLower())
     {
         case "add":
             break;
         case "delete":
         case "del":
             Zone z = ply.FindApplicableZone();
             if (z == null)
             {
                 ply.SendDirectedMessage("You are in no zone!");
             }
             else
             {
                 Program.zones.Remove(z);
                 ply.SendDirectedMessage("Zone deleted!");
             }
             break;
         case "setpriority":
         case "priority":
             if (cmdparts.Length < 3) ply.SendDirectedMessage("Please specify the level!");
             else
             {
                 Zone z2 = ply.FindApplicableZone();
                 if (z2 == null)
                 {
                     ply.SendDirectedMessage("You are in no zone!");
                 }
                 else
                 {
                     z2.priority = Convert.ToInt32(cmdparts[2]);
                     ply.SendDirectedMessage("Set *zone* priority to: " + cmdparts[2]);
                 }
             }
             break;
         case "setlevel":
         case "level":
             if (cmdparts.Length < 3) ply.SendDirectedMessage("Please specify the level!");
             else
             {
                 Zone z3 = ply.FindApplicableZone();
                 if (z3 == null)
                 {
                     Program.zoneDefaultLevel = Convert.ToInt32(cmdparts[2]);
                     ply.SendDirectedMessage("Set *default* build level to: " + cmdparts[2]);
                 }
                 else
                 {
                     z3.level = Convert.ToInt32(cmdparts[2]);
                     ply.SendDirectedMessage("Set *zone* build level to: " + cmdparts[2]);
                 }
             }
             break;
         default:
             ply.SendDirectedMessage("Unknown zone command");
             break;
     }
     Program.SaveZones();
 }
开发者ID:astory,项目名称:MCAdmin,代码行数:60,代码来源:ZoneCommand.cs

示例7: Run

        public override void Run(Player ply, string[] cmdparts)
        {
            Player ply2 = Program.minecraftFirewall.FindPlayer(cmdparts[1]);
            if (ply2 == null) { ply.SendDirectedMessage("Sorry, target could not be found!"); return; }

            if ((!ply2.allowTP) && ply.GetLevel() <= ply2.GetLevel()) { ply.SendDirectedMessage("Sorry, target has disallowed incoming teleports!"); return; }

            Program.SendServerCommand("tp " + ply.name + " " + ply2.name);
            Program.AddRTLine(Color.Black, ply.name + " teleported to " + ply2.name + "\n", true);
            Program.SendServerMessage(ply.name + " teleported to " + ply2.name);
        }
开发者ID:astory,项目名称:MCAdmin,代码行数:11,代码来源:TpCommand.cs

示例8: Run

 public override void Run(Player ply, string[] cmdparts)
 {
     Player giveto = ply;
     int amt = 1;
     if (cmdparts.Length >= 4) giveto = Program.minecraftFirewall.FindPlayer(cmdparts[3]);
     if (cmdparts.Length >= 3) amt = Convert.ToInt32(cmdparts[2]);
     if (!giveto.GiveItem(cmdparts[1].Replace('_', ' '), amt))
         ply.SendDirectedMessage("Item could not be given!");
     else
         ply.SendDirectedMessage("Item given successfully!"); ;
 }
开发者ID:astory,项目名称:MCAdmin,代码行数:11,代码来源:GiveCommand.cs

示例9: Run

 public override void Run(Player ply, string[] cmdparts)
 {
     if (Program.PlyGetRank(cmdparts[1]) != "banned") { ply.SendDirectedMessage("Player is not banned!"); return; }
     Program.PlySetRank(cmdparts[1], Program.GetServerProperty("default-rank","guest"));
     Heartbeats.MasterBans.UnbanUser(cmdparts[1], ply.name);
     Program.SendServerMessage(ply.name + " unbanned " + cmdparts[1]);
 }
开发者ID:astory,项目名称:MCAdmin,代码行数:7,代码来源:UnbanCommand.cs

示例10: Run

 public override void Run(Player ply, string[] cmdparts)
 {
     Player ply2 = Program.minecraftFirewall.FindPlayer(cmdparts[1]);
     if (ply2 == null) { ply.SendDirectedMessage("Sorry, target could not be found!"); return; }
     Program.SendServerCommand("tp " + ply2.name + " " + ply.name);
     Program.AddRTLine(Color.Black, ply.name + " summoned " + ply2.name + "\n", true);
     Program.SendServerMessage(ply.name + " summoned " + ply2.name);
 }
开发者ID:astory,项目名称:MCAdmin,代码行数:8,代码来源:SummonCommand.cs

示例11: Run

 public override void Run(Player ply, string[] cmdparts)
 {
     if (cmdparts.Length <= 1)
     {
         string str = "";
         int curlvl = ply.GetLevel();
         foreach (KeyValuePair<string, Command> kv in Program.commands)
         {
             if (kv.Value.minlevel <= curlvl) str += "!" + kv.Key + ", ";
         }
         ply.SendDirectedMessage("Available commands: " + ((str.Length > 2) ? str.Remove(str.Length - 2) : "None"));
         ply.SendDirectedMessage("For more help use !help command");
         ply.SendDirectedMessage("Do not type <> or [] around parameters.");
         ply.SendDirectedMessage("<> means the parameter is required, [] that it is optional");
     }
     else
     {
         string cmdStr = cmdparts[1].ToLower();
         if (cmdStr[0] == '!' || cmdStr[0] == '/') cmdStr = cmdStr.Substring(1);
         if (!Program.commands.ContainsKey(cmdStr)) { ply.SendDirectedMessage("Unknown command!"); return; }
         Command cmd = Program.commands[cmdStr];
         ply.SendDirectedMessage(cmd.Help);
         ply.SendDirectedMessage("Usage: !" + cmdStr + " " + cmd.Usage);
     }
 }
开发者ID:astory,项目名称:MCAdmin,代码行数:25,代码来源:HelpCommand.cs

示例12: Run

 public override void Run(Player ply, string[] cmdparts)
 {
     if (ply.GetLevel() <= Program.PlyGetLevel(cmdparts[1])) { ply.SendPermissionDenied(); return; }
     string rank = cmdparts[2].ToLower();
     if (!Program.ranklevels.ContainsKey(rank)) { ply.SendDirectedMessage("Rank does not exist!"); return; }
     if (Program.ranklevels[rank] >= ply.GetLevel()) { ply.SendPermissionDenied(); return; }
     Program.PlySetRank(cmdparts[1], rank);
     Program.SendServerMessage(ply.name + " set rank of " + cmdparts[1] + " to " + Program.PlyGetRank(cmdparts[1]));
 }
开发者ID:astory,项目名称:MCAdmin,代码行数:9,代码来源:SetrankCommand.cs

示例13: Run

 public override void Run(Player ply, string[] cmdparts)
 {
     if (cmdparts.Length < 2 || cmdparts[1].ToLower() == "normal")
     {
         ply.forcedtime = -1;
         ply.SendDirectedMessage("Reset Your Time back to normal!");
         return;
     }
     int settime = -1;
     switch (cmdparts[1].ToLower())
     {
         case "night":
             settime = 0;
             break;
         case "day":
             settime = 12;
             break;
         case "morning":
             settime = 6;
             break;
         case "afternoon":
             settime = 18;
             break;
         default:
             try
             {
                 settime = Convert.ToInt32(cmdparts[1]);
             }
             catch { }
             break;
     }
     if (settime < 0 || settime > 23) { ply.SendDirectedMessage("Invalid time entered!"); return; }
     if (settime < 6)
     {
         ply.forcedtime = (18 + settime) * 1000;
     }
     else
     {
         ply.forcedtime = (settime - 6) * 1000;
     }
     ply.SendDirectedMessage("You Forced Your Time to be: " + settime.ToString() + ":00");
 }
开发者ID:astory,项目名称:MCAdmin,代码行数:42,代码来源:TimeCommand.cs

示例14: Run

        public override void Run(Player ply, string[] cmdparts)
        {
            try
            {
                Player ply2 = Program.minecraftFirewall.FindPlayer(cmdparts[1]);
                if (ply2 == null) { ply.SendDirectedMessage("Sorry, target could not be found!"); return; }

                var message = new StringBuilder();

                for (var i = 2; i < cmdparts.Length; i++)
                    message.Append(cmdparts[i] + " ");
                message.Remove(message.Length - 1, 1);

                Program.AddRTLine(Color.Black, "[PM] " + ply.name + " to " + ply2.name + ": " + message + "\n", true);
                ply.SendDirectedMessage("§e[PM >] §f" + ply2.name + "§f: " + message);
                ply2.SendDirectedMessage("§e[PM <] §f" + ply.name + "§f: " + message);
            }
            catch (Exception ex)
            {
                Program.SendLogMsg(ex.ToString());
            }
        }
开发者ID:astory,项目名称:MCAdmin,代码行数:22,代码来源:PrivateMessageCommand.cs

示例15: Run

 public override void Run(Player ply, string[] cmdparts)
 {
     if (cmdparts.Length <= 1)
     {
         string str = "";
         int prank = ply.GetLevel();
         foreach (Kit k in Program.kits)
         {
             if (prank >= k.reqlevel) str += k.name + ", ";
         }
         ply.SendDirectedMessage("Available kits: " + ((str.Length > 2) ? str.Remove(str.Length - 2) : "None"));
     }
     else
     {
         Player giveto = ply;
         if (cmdparts.Length >= 3) giveto = Program.minecraftFirewall.FindPlayer(cmdparts[2]);
         if (giveto == null) { ply.SendDirectedMessage("Player not found!"); return; }
         string kitname = cmdparts[1].ToLower();
         Kit kit = null;
         foreach (Kit k in Program.kits)
         {
             if (k.name == kitname)
             {
                 kit = k;
                 break;
             }
         }
         if (kit == null) { ply.SendDirectedMessage("Kit not found!"); return; }
         if (!ply.HasLevel(kit.reqlevel)) { ply.SendPermissionDenied(); return; }
         foreach (KeyValuePair<int, int> kv in kit.items)
         {
             if (!giveto.GiveItem(kv.Key, kv.Value))
             {
                 ply.SendDirectedMessage("Kit could not be given!");
                 break;
             }
         }
     }
 }
开发者ID:astory,项目名称:MCAdmin,代码行数:39,代码来源:KitCommand.cs


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