public void ChangeMap([NotNull] Map newMap)
{
if (newMap == null)
{
throw new ArgumentNullException("newMap");
}
MapChangedOn = DateTime.UtcNow;
lock (SyncRoot)
{
World newWorld = new World(Name)
{
AccessSecurity = (SecurityController)AccessSecurity.Clone(),
BuildSecurity = (SecurityController)BuildSecurity.Clone(),
IsHidden = IsHidden,
IsRealm = IsRealm,
BlockDB = BlockDB,
lastBackup = lastBackup,
BackupInterval = BackupInterval,
IsLocked = IsLocked,
LockedBy = LockedBy,
UnlockedBy = UnlockedBy,
LockedDate = LockedDate,
UnlockedDate = UnlockedDate,
LoadedBy = LoadedBy,
LoadedOn = LoadedOn,
MapChangedBy = MapChangedBy,
MapChangedOn = MapChangedOn,
FogColor = FogColor,
CloudColor = CloudColor,
SkyColor = SkyColor,
EdgeLevel = EdgeLevel,
SideBlock = SideBlock,
EdgeBlock = EdgeBlock,
CloudColorCC = CloudColorCC,
SkyColorCC = SkyColorCC,
FogColorCC = FogColorCC,
sideLevel = sideLevel,
sideBlock = sideBlock,
edgeBlock = edgeBlock,
textureURL = textureURL
};
newWorld.Map = newMap;
newWorld.NeverUnload = neverUnload;
WorldManager.ReplaceWorld(this, newWorld);
lock (BlockDB.SyncRoot) {
BlockDB.Clear();
BlockDB.World = newWorld;
}
foreach (Player player in Players)
{
player.JoinWorld(newWorld, WorldChangeReason.Rejoin);
}
}
}