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


C# Player.GetLevel方法代码示例

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


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

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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: Run

        public override void Run(Player ply, string[] cmdparts)
        {
            if (ply.GetLevel() <= Program.PlyGetLevel(cmdparts[1])) { ply.SendPermissionDenied(); 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 + ")";
            }

            Player ply2 = Program.minecraftFirewall.FindPlayer(cmdparts[1]);
            if (ply2 == null)
            {
                Program.PlySetRank(cmdparts[1], "banned");
                Program.SendServerMessage(ply.name + " banned " + cmdparts[1]);
            }
            else
            {
                Program.PlySetRank(ply2.name, "banned");
                ply2.Disconnect("Kickbanned by " + ply.name + reasonstr);
                Program.SendServerMessage(ply.name + " kickbanned " + ply2.name + reasonstr);
            }

            if (reason != "") Heartbeats.MasterBans.BanUser(cmdparts[1], ply.name, reason);
            else if (Program.mbansEnable && Program.mbansSubmit)
            {
                ply.SendDirectedMessage("§4Global Ban Submission Declined!");
                ply.SendDirectedMessage("§ePlease reban again with a reason (!ban name reason)!");
            }

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


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