Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed: MCServerChunkGenerator now only holds the session lock while c…

…hanging the spawn point.

Holding the session lock forever in the temp world cache isn't possible, so the temp worlds are opened read-only for copying chunks and read-write for updating the spawn point.
  • Loading branch information...
commit 2745b7e542fcb62cca2474b6667b76dfefa40d0c 1 parent 5e19f74
@codewarrior0 codewarrior0 authored
Showing with 10 additions and 3 deletions.
  1. +10 −3 minecraft_server.py
View
13 minecraft_server.py
@@ -315,8 +315,11 @@ def tempWorldForLevel(self, level):
tempWorldDir = os.path.join(tempDir, worldName)
tempWorld = infiniteworld.MCInfdevOldLevel(tempWorldDir, create=True, random_seed=level.RandomSeed)
+ tempWorld.close()
- self.tempWorldCache[self.serverVersion, level.RandomSeed] = tempWorld
+ tempWorldRO = infiniteworld.MCInfdevOldLevel(tempWorldDir, readonly=True)
+
+ self.tempWorldCache[self.serverVersion, level.RandomSeed] = tempWorldRO
if level.dimNo == 0:
properties["allow-nether"] = "false"
@@ -334,8 +337,12 @@ def generateAtPosition(self, tempWorld, tempDir, cx, cz):
return exhaust(self.generateAtPositionIter(tempWorld, tempDir, cx, cz))
def generateAtPositionIter(self, tempWorld, tempDir, cx, cz, simulate=False):
- tempWorld.setPlayerSpawnPosition((cx * 16, 64, cz * 16))
- tempWorld.saveInPlace()
+ tempWorldRW = infiniteworld.MCInfdevOldLevel(tempWorld.filename)
+ tempWorldRW.setPlayerSpawnPosition((cx * 16, 64, cz * 16))
+ tempWorldRW.saveInPlace()
+ tempWorldRW.close()
+ del tempWorldRW
+
tempWorld.unload()
startTime = time.time()
Please sign in to comment.
Something went wrong with that request. Please try again.