          }
      }
  
-@@ -807,6 +852,7 @@
+@@ -807,6 +854,7 @@
          this.checkSessionLock();
          this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.getConfigurationManager().getTagsFromLastWrite());
          this.mapStorage.saveAllData();

+            doneChunks.clear();
+        }
+
+        final long time = -System.currentTimeMillis();
 
         while (var3.hasNext())
         {
@@ -308,14 +331,16 @@
             Chunk var7 = this.getChunkFromChunkCoords(var4.chunkXPos, var4.chunkZPos);
             this.moodSoundAndLightCheck(var5, var6, var7);
             this.theProfiler.endStartSection("tickChunk");
-            var7.updateSkylight();
+            if (System.currentTimeMillis() + time <= 4 && doneChunks.add(var4)) { //Limits and evenly distributes the lighting update time
+                var7.updateSkylight();
+            }
             this.theProfiler.endStartSection("thunder");

 
         for (int var2 = 0; var2 < 10; ++var2)
         {
@@ -796,6 +842,7 @@
             }
 
             this.chunkProvider.saveChunks(par1, par2IProgressUpdate);
