static void WorldMainHandler( Player player, Command cmd ) {
string param = cmd.Next();
if( param == null ) {
player.Message( "Main world is {0}", WorldManager.MainWorld.ClassyName );
var mainedRanks = RankManager.Ranks
.Where( r => r.MainWorld != null && r.MainWorld != WorldManager.MainWorld );
if( mainedRanks.Count() > 0 ) {
player.Message( "Rank mains: {0}",
mainedRanks.JoinToString( r => String.Format( "{0}&S for {1}&S",
// ReSharper disable PossibleNullReferenceException
r.MainWorld.ClassyName,
// ReSharper restore PossibleNullReferenceException
r.ClassyName ) ) );
}
return;
}
if( param.StartsWith( "@" ) ) {
string rankName = param.Substring( 1 );
Rank rank = RankManager.FindRank( rankName );
if( rank == null ) {
player.MessageNoRank( rankName );
return;
}
string worldName = cmd.Next();
if( worldName == null ) {
if( rank.MainWorld != null ) {
player.Message( "Main world for rank {0}&S is {1}",
rank.ClassyName,
rank.MainWorld.ClassyName );
} else {
player.Message( "Main world for rank {0}&S is {1}&S (default)",
rank.ClassyName,
WorldManager.MainWorld.ClassyName );
}
} else {
World world = WorldManager.FindWorldOrPrintMatches( player, worldName );
if( world != null ) {
SetRankMainWorld( player, rank, world );
}
}
} else {
World world = WorldManager.FindWorldOrPrintMatches( player, param );
if( world != null ) {
SetMainWorld( player, world );
}
}
}