本文整理汇总了C#中MCForge.Player.SendToPos方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SendToPos方法的具体用法?C# Player.SendToPos怎么用?C# Player.SendToPos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCForge.Player
的用法示例。
在下文中一共展示了Player.SendToPos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
public void Use(Player p, string[] args)
{
if (args.Length > 2)
{
p.SendMessage("Invalid arguments!");
return;
}
else if (args.Length == 0)
{
Point3 meep = new Point3((short)(0.5 + p.level.SpawnPos.x * 32), (short)(0.5 + p.level.SpawnPos.z * 32), (short)(1 + p.level.SpawnPos.y * 32));
p.SendToPos(meep, p.level.SpawnRot);
}
else if (args.Length == 1)
{
Player who = Player.Find(args[0]);
if (who == null || who.isHidden) //Permissions needed
{
p.SendMessage("Player: " + args[0] + " not found!");
return;
}
else if (who == p)
{
p.SendMessage("Why are you trying to teleport yourself to yourself?");
return;
}
/*else if (!ServerSettings.higherranktp)
{
//Permissions to check ranks.
p.SendMessage("You cannot teleport to a player of higher rank!");
return;
}*/
else
{
if (p.level != who.level)
{
//Need goto here
if (who.isLoading)
{
p.SendMessage("Waiting for " + who.color + who.USERNAME + Server.DefaultColor + " to spawn...");
while (who.isLoading) { }
}
}
}
p.SendToPos(who.Pos, who.Rot);
return;
}
else
{
Player one = Player.Find(args[0]);
Player two = Player.Find(args[1]);
if (one == null || two == null)
{
//Hehe
p.SendMessage((one == null && two == null) ? "Players: " + args[0] + " and " + args[1] + " not found!" : "Player: " + ((one == null) ? args[0] : args[1]) + " not found!");
return;
}
else if (one == p && two == p || one == p)
{
p.SendMessage((two == p) ? "Why are you trying to teleport yourself to yourself?" : "Why not just use /tp " + args[1] + "?");
return;
}
else if (two == p)
{
p.SendMessage("Why not just use /summon " + args[0] + "?");
return;
}
/*else if (p.permission < one.permission)
{
//Permissions to check ranks.
p.SendMessage("You cannot force a player of higher rank to tp to another player!");
}*/
else
{
if (one.level != two.level)
{
//Need goto here
if (two.isLoading)
{
p.SendMessage("Waiting for " + two.color + two.USERNAME + Server.DefaultColor + " to spawn...");
while (two.isLoading) { }
}
}
}
one.SendToPos(two.Pos, two.Rot);
p.SendMessage(one.USERNAME + " has been succesfully teleported to " + two.USERNAME + "!");
return;
}
}