private static void WorldBringHandler( Player player, Command cmd )
{
string playerName = cmd.Next();
string worldName = cmd.Next();
if ( playerName == null || worldName == null ) {
CdWorldBring.PrintUsage( player );
return;
}
Player target = Server.FindPlayerOrPrintMatches( player, playerName, false, true );
World world = WorldManager.FindWorldOrPrintMatches( player, worldName );
if ( target == null || world == null )
return;
if ( target == player ) {
player.Message( "&WYou cannot &H/WBring&W yourself." );
return;
}
if ( !player.Can( Permission.Bring, target.Info.Rank ) ) {
player.Message( "You may only bring players ranked {0}&S or lower.",
player.Info.Rank.GetLimit( Permission.Bring ).ClassyName );
player.Message( "{0}&S is ranked {1}",
target.ClassyName, target.Info.Rank.ClassyName );
return;
}
if ( world == target.World ) {
player.Message( "Player {0}&S is already in world {1}&S. They were brought to spawn.",
target.ClassyName, world.ClassyName );
target.TeleportTo( target.WorldMap.Spawn );
return;
}
SecurityCheckResult check = world.AccessSecurity.CheckDetailed( target.Info );
if ( check == SecurityCheckResult.RankTooHigh || check == SecurityCheckResult.RankTooLow ) {
if ( player.CanJoin( world ) ) {
if ( cmd.IsConfirmed ) {
BringPlayerToWorld( player, target, world, true, false );
} else {
player.Confirm( cmd,
"Player {0}&S is ranked too low to join {1}&S. Override world permissions?",
target.ClassyName,
world.ClassyName );
}
} else {
player.Message( "Neither you nor {0}&S are allowed to join world {1}",
target.ClassyName, world.ClassyName );
}
} else {
BringPlayerToWorld( player, target, world, false, false );
}
}