本文整理汇总了C#中fCraft.Player.JoinWorldNow方法的典型用法代码示例。如果您正苦于以下问题:C# Player.JoinWorldNow方法的具体用法?C# Player.JoinWorldNow怎么用?C# Player.JoinWorldNow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fCraft.Player
的用法示例。
在下文中一共展示了Player.JoinWorldNow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: JoinHandler
static void JoinHandler(Player player, Command cmd)
{
string worldName = cmd.Next();
if (worldName == null)
{
CdJoin.PrintUsage(player);
return;
}
if (worldName == "-")
{
if (player.LastUsedWorldName != null)
{
worldName = player.LastUsedWorldName;
}
else
{
player.Message("Cannot repeat world name: you haven't used any names yet.");
return;
}
}
World[] worlds = WorldManager.FindWorlds(player, worldName);
if (worlds.Length > 1)
{
player.MessageManyMatches("world", worlds);
}
else if (worlds.Length == 1)
{
World world = worlds[0];
player.LastUsedWorldName = world.Name;
switch (world.AccessSecurity.CheckDetailed(player.Info))
{
case SecurityCheckResult.Allowed:
case SecurityCheckResult.WhiteListed:
if (world.IsFull)
{
player.Message("Cannot join {0}&S: world is full.", world.ClassyName);
return;
}
player.StopSpectating();
if (!player.JoinWorldNow(world, true, WorldChangeReason.ManualJoin))
{
player.Message("ERROR: Failed to join world. See log for details.");
}
break;
case SecurityCheckResult.BlackListed:
player.Message("Cannot join world {0}&S: you are blacklisted.",
world.ClassyName);
break;
case SecurityCheckResult.RankTooLow:
player.Message("Cannot join world {0}&S: must be {1}+",
world.ClassyName, world.AccessSecurity.MinRank.ClassyName);
break;
}
}
else
{
// no worlds found - see if player meant to type in "/Join" and not "/TP"
Player[] players = Server.FindPlayers(player, worldName, true);
if (players.Length == 1)
{
player.LastUsedPlayerName = players[0].Name;
player.StopSpectating();
player.ParseMessage("/TP " + players[0].Name, false, true);
}
else
{
player.MessageNoWorld(worldName);
}
}
}
示例2: JoinHandler
static void JoinHandler( Player player, CommandReader cmd ) {
string worldName = cmd.Next();
if( worldName == null ) {
CdJoin.PrintUsage( player );
return;
}
if( worldName == "-" ) {
if( player.LastUsedWorldName != null ) {
worldName = player.LastUsedWorldName;
} else {
player.Message( "Cannot repeat world name: you haven't used any names yet." );
return;
}
}
World[] worlds = WorldManager.FindWorlds( player, worldName );
if( worlds.Length > 1 ) {
player.MessageManyMatches( "world", worlds );
} else if( worlds.Length == 1 ) {
World world = worlds[0];
player.LastUsedWorldName = world.Name;
switch( world.AccessSecurity.CheckDetailed( player.Info ) ) {
case SecurityCheckResult.Allowed:
case SecurityCheckResult.WhiteListed:
if( world.IsFull ) {
player.Message( "Cannot join {0}&S: world is full.", world.ClassyName );
return;
}
player.StopSpectating();
if( !player.JoinWorldNow( world, true, WorldChangeContext.ManualJoin ) ) {
player.Message( "ERROR: Failed to join world. See log for details." );
}
break;
case SecurityCheckResult.BlackListed:
player.Message( "Cannot join world {0}&S: you are blacklisted.",
world.ClassyName );
break;
case SecurityCheckResult.RankTooLow:
player.Message( "Cannot join world {0}&S: must be {1}+",
world.ClassyName, world.AccessSecurity.MinRank.ClassyName );
break;
// TODO: Uncomment
//case SecurityCheckResult.RankTooHigh:
// player.Message("Cannot join world {0}&S: must be {1}-",
// world.ClassyName, world.AccessSecurity.MaxRank.ClassyName);
// break;
}
} else {
player.MessageNoWorld( worldName );
}
}