本文整理汇总了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]));
}
示例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!");
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
示例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;
}
}
}
}
示例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!");
}