static void SetRankMainWorld( Player player, Rank rank, World world ) {
if( world == rank.MainWorld ) {
player.Message( "World {0}&S is already set as main for {1}&S.",
world.ClassyName, rank.ClassyName );
return;
}
if( world == WorldManager.MainWorld ) {
if( rank.MainWorld == null ) {
player.Message( "The main world for rank {0}&S is already {1}&S (default).",
rank.ClassyName, world.ClassyName );
} else {
rank.MainWorld = null;
WorldManager.SaveWorldList();
Server.Message( "&SPlayer {0}&S has reset the main world for rank {1}&S.",
player.ClassyName, rank.ClassyName );
Logger.Log( LogType.UserActivity,
"{0} reset the main world for rank {1}.",
player.Name, rank.Name );
}
return;
}
if( world.AccessSecurity.MinRank > rank ) {
player.Message( "World {0}&S requires {1}+&S to join, so it cannot be used as the main world for rank {2}&S.",
world.ClassyName, world.AccessSecurity.MinRank, rank.ClassyName );
return;
}
rank.MainWorld = world;
WorldManager.SaveWorldList();
Server.Message( "&SPlayer {0}&S designated {1}&S to be the main world for rank {2}",
player.ClassyName, world.ClassyName, rank.ClassyName );
Logger.Log( LogType.UserActivity,
"{0} set {1} to be the main world for rank {2}.",
player.Name, world.Name, rank.Name );
}