本文整理汇总了C#中fCraft.Player.JoinWorld方法的典型用法代码示例。如果您正苦于以下问题:C# Player.JoinWorld方法的具体用法?C# Player.JoinWorld怎么用?C# Player.JoinWorld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fCraft.Player
的用法示例。
在下文中一共展示了Player.JoinWorld方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TeleportHandler
static void TeleportHandler( Player player, CommandReader cmd ) {
string name = cmd.Next();
if( name == null ) {
CdTeleport.PrintUsage( player );
return;
}
if( cmd.Next() != null ) {
cmd.Rewind();
int x, y, z;
if( cmd.NextInt( out x ) && cmd.NextInt( out y ) && cmd.NextInt( out z ) ) {
if( x <= -1024 || x >= 1024 || y <= -1024 || y >= 1024 || z <= -1024 || z >= 1024 ) {
player.Message( "Coordinates are outside the valid range!" );
} else {
player.TeleportTo( new Position {
X = (short)(x * 32 + 16),
Y = (short)(y * 32 + 16),
Z = (short)(z * 32 + 16),
R = player.Position.R,
L = player.Position.L
} );
}
} else {
CdTeleport.PrintUsage( player );
}
} else {
if( name == "-" ) {
if( player.LastUsedPlayerName != null ) {
name = player.LastUsedPlayerName;
} else {
player.Message( "Cannot repeat player name: you haven't used any names yet." );
return;
}
}
Player[] matches = Server.FindPlayers( player, name, false, true, true );
if( matches.Length == 1 ) {
Player target = matches[0];
World targetWorld = target.World;
if( targetWorld == null ) PlayerOpException.ThrowNoWorld( target );
if( targetWorld == player.World ) {
player.TeleportTo( target.Position );
} else {
switch( targetWorld.AccessSecurity.CheckDetailed( player.Info ) ) {
case SecurityCheckResult.Allowed:
case SecurityCheckResult.WhiteListed:
if( targetWorld.IsFull ) {
player.Message( "Cannot teleport to {0}&S because world {1}&S is full.",
target.ClassyName,
targetWorld.ClassyName );
return;
}
player.StopSpectating();
player.JoinWorld( targetWorld, WorldChangeReason.Tp, target.Position );
break;
case SecurityCheckResult.BlackListed:
player.Message( "Cannot teleport to {0}&S because you are blacklisted on world {1}",
target.ClassyName,
targetWorld.ClassyName );
break;
case SecurityCheckResult.RankTooLow:
player.Message( "Cannot teleport to {0}&S because world {1}&S requires {2}+&S to join.",
target.ClassyName,
targetWorld.ClassyName,
targetWorld.AccessSecurity.MinRank.ClassyName );
break;
}
}
} else if( matches.Length > 1 ) {
player.MessageManyMatches( "player", matches );
} else {
player.MessageNoPlayer( name );
}
}
}
示例2: BackHandler
static void BackHandler(Player player, Command cmd)
{
if (player.previousLocation == null)
{
player.Message("&cYou haven't been teleported somewhere yet!");
return;
}
else
{
player.Message("&aTeleporting you back to your previous location...");
if (player.previousWorld == null)
{
player.TeleportTo(player.previousLocation);
}
else
{
player.JoinWorld(player.previousWorld, WorldChangeReason.ManualJoin);
player.TeleportTo(player.previousLocation);
}
return;
}
}
示例3: RejoinHandler
static void RejoinHandler(Player player, Command cmd)
{
player.JoinWorld(player.World, WorldChangeReason.Rejoin);
}
示例4: BackHandler
private static void BackHandler(Player player, CommandReader cmd) {
if (player.LastPosition == null || player.LastWorld == null) {
player.Message("Unknown last location!");
return;
}
if (player.LastWorld != player.World) {
player.JoinWorld(player.LastWorld, WorldChangeReason.ManualJoin, player.LastPosition);
} else {
player.TeleportTo(player.LastPosition);
player.Message("Teleported to last location!");
}
}
示例5: SpectateHandler
static void SpectateHandler( Player player, Command cmd )
{
string targetName = cmd.Next();
if( targetName == null ) {
PlayerInfo lastSpec = player.LastSpectatedPlayer;
if( lastSpec != null ) {
Player spec = player.SpectatedPlayer;
if( spec != null )
{
if (spec.World.Name != player.World.Name)
{
player.JoinWorld(spec.World, WorldChangeReason.SpectateTargetJoined);
player.Message("Joined " + spec.World.Name + " to continue spectating " + spec.ClassyName);
}
player.Message( "Now spectating {0}", spec.ClassyName );
}
else
{
player.Message( "Last spectated {0}", lastSpec.ClassyName );
}
} else {
CdSpectate.PrintUsage( player );
}
return;
}
Player target = Server.FindPlayerOrPrintMatches( player, targetName, false, true );
if( target == null ) return;
if( target == player ) {
player.Message( "You cannot spectate yourself." );
return;
}
if( !player.Can( Permission.Spectate, target.Info.Rank ) ) {
player.Message( "You may only spectate players ranked {0}&S or lower.",
player.Info.Rank.GetLimit( Permission.Spectate ).ClassyName );
player.Message( "{0}&S is ranked {1}",
target.ClassyName, target.Info.Rank.ClassyName );
return;
}
if( !player.Spectate( target ) ) {
player.Message( "Already spectating {0}", target.ClassyName );
}
}
示例6: TeleportHandler
//.........这里部分代码省略.........
Z = (short) (z*32 + 48),
R = (byte) rot,
L = (byte) lot
});
}
} else {
CdTeleport.PrintUsage(player);
}
} else {
if (name == "-") {
if (player.LastUsedPlayerName != null) {
name = player.LastUsedPlayerName;
} else {
player.Message("Cannot repeat player name: you haven't used any names yet.");
return;
}
}
Player[] matches = Server.FindPlayers(player, name, SearchOptions.Default);
if (matches.Length == 1) {
Player target = matches[0];
World targetWorld = target.World;
if (targetWorld == null) PlayerOpException.ThrowNoWorld(target);
if (target.Info.TPDeny && target.Info.Rank >= player.Info.Rank) {
player.Message("&CThis player does not want people teleporting to them");
player.Message("Cannot teleport to {0}&S.", target.ClassyName, targetWorld.ClassyName,
targetWorld.AccessSecurity.MinRank.ClassyName);
return;
}
if (targetWorld == player.World) {
if (player.World != null) {
player.LastWorld = player.World;
player.LastPosition = player.Position;
}
player.TeleportTo(target.Position);
} else {
if (targetWorld.Name.StartsWith("PW_") &&
!targetWorld.AccessSecurity.ExceptionList.Included.Contains(player.Info)) {
player.Message(
"You cannot join due to that player being in a personal world that you cannot access.");
return;
}
switch (targetWorld.AccessSecurity.CheckDetailed(player.Info)) {
case SecurityCheckResult.Allowed:
case SecurityCheckResult.WhiteListed:
if (player.Info.Rank.Name == "Banned") {
player.Message("&CYou can not change worlds while banned.");
player.Message("Cannot teleport to {0}&S.", target.ClassyName,
targetWorld.ClassyName, targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
if (targetWorld.IsFull) {
player.Message("Cannot teleport to {0}&S because world {1}&S is full.",
target.ClassyName, targetWorld.ClassyName);
player.Message("Cannot teleport to {0}&S.", target.ClassyName,
targetWorld.ClassyName, targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
player.StopSpectating();
player.JoinWorld(targetWorld, WorldChangeReason.Tp, target.Position);
break;
case SecurityCheckResult.BlackListed:
player.Message("Cannot teleport to {0}&S because you are blacklisted on world {1}",
target.ClassyName, targetWorld.ClassyName);
break;
case SecurityCheckResult.RankTooLow:
if (player.Info.Rank.Name == "Banned") {
player.Message("&CYou can not change worlds while banned.");
player.Message("Cannot teleport to {0}&S.", target.ClassyName,
targetWorld.ClassyName, targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
if (targetWorld.IsFull) {
if (targetWorld.IsFull) {
player.Message("Cannot teleport to {0}&S because world {1}&S is full.",
target.ClassyName, targetWorld.ClassyName);
player.Message("Cannot teleport to {0}&S.", target.ClassyName,
targetWorld.ClassyName, targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
player.StopSpectating();
player.JoinWorld(targetWorld, WorldChangeReason.Tp, target.Position);
break;
}
player.Message("Cannot teleport to {0}&S because world {1}&S requires {2}+&S to join.",
target.ClassyName, targetWorld.ClassyName,
targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
}
} else if (matches.Length > 1) {
player.MessageManyMatches("player", matches);
}
}
}
示例7: MWHandler
//.........这里部分代码省略.........
File.Delete("./maps/PW_" + player.Name + "_" + wNumberd + ".fcm");
}
player.Message("Your personal world({0}) has been deleted!", wNumberd);
Server.RequestGC();
break;
#endregion
#region Join
case "j":
case "join":
string wNumberStringj = cmd.Next();
int wNumberj;
if (!int.TryParse(wNumberStringj, out wNumberj)) {
wNumberj = 1;
}
string playerStringj = cmd.Next();
PlayerInfo playerj = null;
if (playerStringj != null) {
playerj = PlayerDB.FindPlayerInfoOrPrintMatches(player, playerStringj, SearchOptions.Default);
}
string mapFilej = WorldManager.FindMapFile(Player.Console,
"PW_" + ((playerj == null) ? player.Name : playerj.Name) + "_" + wNumberj);
if (mapFilej == null) {
player.Message("{0} no personal worlds by that number: {1}",
(playerj == null) ? "You have" : "There are", wNumberj);
break;
}
World worldj =
WorldManager.FindWorldExact("PW_" + ((playerj == null) ? player.Name : playerj.Name) + "_" +
wNumberj);
if (worldj != null && player.CanJoin(worldj)) {
player.JoinWorld(worldj, WorldChangeReason.ManualJoin);
} else {
player.Message("You cannot join that world!");
}
break;
#endregion
#region BuildAccess
case "buildaccess":
case "ba":
string wNumberStringba = cmd.Next();
string exceptionba = cmd.Next();
int wNumberba;
bool changesWereMade = false;
if (!int.TryParse(wNumberStringba, out wNumberba)) {
wNumberba = 1;
exceptionba = wNumberStringba;
}
string mapFileba = WorldManager.FindMapFile(Player.Console, "PW_" + player.Name + "_" + wNumberba);
if (mapFileba == null) {
player.Message("You have no personal worlds by that number: {0}", wNumberba);
break;
}
World worldba = WorldManager.FindWorldExact("PW_" + player.Name + "_" + wNumberba);
if (exceptionba == null) {
CdMyWorld.PrintUsage(player);
break;
}
if (exceptionba.Equals("-*")) {
PlayerInfo[] oldWhitelistba = worldba.BuildSecurity.ExceptionList.Included.ToArray();
示例8: rejoinHandler
static void rejoinHandler(Player player, CommandReader cmd)
{
player.JoinWorld(player.World, WorldChangeReason.Rejoin, player.Position);
}
示例9: BotHandler
//.........这里部分代码省略.........
}
player.Message("Changed entity model to {0} with skin {1}.", model, skinString2 ?? bot.SkinName);
bot.changeBotModel(model, skinString2 ?? bot.SkinName);
} else
player.Message(
"Usage is /Ent model <bot> <model>. Valid models are chicken, creeper, human, pig, sheep, skeleton, spider, zombie, or any block ID/Name.");
break;
case "bring":
bot.teleportBot(player.Position);
break;
case "tp":
case "teleport":
World targetWorld = bot.World;
Bot target = bot;
if (targetWorld == player.World) {
if (player.World != null) {
player.LastWorld = player.World;
player.LastPosition = player.Position;
}
player.TeleportTo(target.Position);
} else {
if (targetWorld.Name.StartsWith("PW_") &&
!targetWorld.AccessSecurity.ExceptionList.Included.Contains(player.Info)) {
player.Message(
"You cannot join due to that Bot being in a personal world that you cannot access.");
break;
}
switch (targetWorld.AccessSecurity.CheckDetailed(player.Info)) {
case SecurityCheckResult.Allowed:
case SecurityCheckResult.WhiteListed:
if (player.Info.Rank.Name == "Banned") {
player.Message("&CYou can not change worlds while banned.");
player.Message("Cannot teleport to {0}&S.", target.Name,
targetWorld.ClassyName, targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
if (targetWorld.IsFull) {
player.Message("Cannot teleport to {0}&S because world {1}&S is full.",
target.Name, targetWorld.ClassyName);
player.Message("Cannot teleport to {0}&S.", target.Name,
targetWorld.ClassyName, targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
player.StopSpectating();
player.JoinWorld(targetWorld, WorldChangeReason.Tp, target.Position);
break;
case SecurityCheckResult.BlackListed:
player.Message("Cannot teleport to {0}&S because you are blacklisted on world {1}",
target.Name, targetWorld.ClassyName);
break;
case SecurityCheckResult.RankTooLow:
if (player.Info.Rank.Name == "Banned") {
player.Message("&CYou can not change worlds while banned.");
player.Message("Cannot teleport to {0}&S.", target.Name,
targetWorld.ClassyName, targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
if (targetWorld.IsFull) {
if (targetWorld.IsFull) {
player.Message("Cannot teleport to {0}&S because world {1}&S is full.",
target.Name, targetWorld.ClassyName);
player.Message("Cannot teleport to {0}&S.", target.Name,
targetWorld.ClassyName, targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
player.StopSpectating();
player.JoinWorld(targetWorld, WorldChangeReason.Tp, target.Position);
break;
}
player.Message("Cannot teleport to {0}&S because world {1}&S requires {2}+&S to join.",
target.Name, targetWorld.ClassyName,
targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
}
break;
case "skin":
string skinString3 = cmd.Next();
if (skinString3 != null) {
if (skinString3.StartsWith("--")) {
skinString3 = string.Format("http://minecraft.net/skin/{0}.png", skinString3.Replace("--", ""));
}
if (skinString3.StartsWith("-+")) {
skinString3 = string.Format("http://skins.minecraft.net/MinecraftSkins/{0}.png", skinString3.Replace("-+", ""));
}
if (skinString3.StartsWith("++")) {
skinString3 = string.Format("http://i.imgur.com/{0}.png", skinString3.Replace("++", ""));
}
}
player.Message("Changed entity skin to {0}.", skinString3 ?? bot.Name);
bot.changeBotSkin(skinString3);
break;
default:
CdEntity.PrintUsage(player);
break;
}
}
示例10: TPHandler2
static void TPHandler2(Player player, Command cmd)
{
string name = cmd.Next();
if (name == null)
{
return;
}
if (cmd.Next() != null)
{
cmd.Rewind();
int x, y, z;
if (cmd.NextInt(out x) && cmd.NextInt(out y) && cmd.NextInt(out z))
{
if (x <= -1024 || x >= 1024 || y <= -1024 || y >= 1024 || z <= -1024 || z >= 1024)
{
player.Message("Coordinates are outside the valid range!");
}
else
{
player.TeleportTo(new Position
{
X = (short)(x * 32 + 16),
Y = (short)(y * 32 + 16),
Z = (short)(z * 32 + 16),
R = player.Position.R,
L = player.Position.L
});
}
}
else
{
return;
}
}
else
{
Player[] matches = Server.FindPlayers(player, name, true);
if (matches.Length == 1)
{
Player target = matches[0];
World targetWorld = target.World;
if (targetWorld == null) PlayerOpException.ThrowNoWorld(target);
if (targetWorld == player.World)
{
player.TeleportTo(target.Position);
}
else
{
switch (targetWorld.AccessSecurity.CheckDetailed(player.Info))
{
case SecurityCheckResult.Allowed:
case SecurityCheckResult.WhiteListed:
if (targetWorld.IsFull)
{
player.Message("Cannot teleport to {0}&S because world {1}&S is full.",
target.ClassyName,
targetWorld.ClassyName);
return;
}
player.StopSpectating();
player.JoinWorld(targetWorld, WorldChangeReason.Tp, target.Position);
break;
case SecurityCheckResult.BlackListed:
player.Message("Cannot teleport to {0}&S because you are blacklisted on world {1}",
target.ClassyName,
targetWorld.ClassyName);
break;
case SecurityCheckResult.RankTooLow:
player.Message("Cannot teleport to {0}&S because world {1}&S requires {2}+&S to join.",
target.ClassyName,
targetWorld.ClassyName,
targetWorld.AccessSecurity.MinRank.ClassyName);
break;
// TODO: case PermissionType.RankTooHigh:
}
}
}
else if (matches.Length > 1)
{
player.MessageManyMatches("player", matches);
}
else
{
// Try to guess if player typed "/TP" instead of "/Join"
World[] worlds = WorldManager.FindWorlds(player, name);
if (worlds.Length == 1)
{
player.LastUsedWorldName = worlds[0].Name;
player.StopSpectating();
player.ParseMessage("/Join " + worlds[0].Name, false);
//.........这里部分代码省略.........