예제 #1
0
 /// <summary> Locks the current world, which prevents blocks in the world from being updated. </summary>
 /// <param name="player"> Player who is issueing the lock. </param>
 /// <returns> True if the world was locked, or false if the world was already locked. </returns>
 public bool Lock([NotNull] Player player)
 {
     if (player == null)
     {
         throw new ArgumentNullException("player");
     }
     lock ( lockLock ) {
         if (IsLocked)
         {
             return(false);
         }
         else
         {
             LockedBy = player.Name;
             LockedOn = DateTime.UtcNow;
             IsLocked = true;
             WorldManager.SaveWorldList();
             Map mapCache = Map;
             if (mapCache != null)
             {
                 mapCache.ClearUpdateQueue();
                 mapCache.CancelAllDrawOps();
             }
             Players.Message("&WWorld was locked by {0}", player.ClassyName);
             Logger.Log(LogType.UserActivity,
                        "World {0} was locked by {1}",
                        Name, player.Name);
             return(true);
         }
     }
 }