mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Fixing previous commit.
This commit is contained in:
parent
c21286dbc3
commit
a17d58fe32
@ -32,7 +32,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
public ArrayList<BlockStoreConversionZDirectory> converters = new ArrayList<BlockStoreConversionZDirectory>();
|
public ArrayList<BlockStoreConversionZDirectory> converters = new ArrayList<BlockStoreConversionZDirectory>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeAll() {
|
public synchronized void closeAll() {
|
||||||
for (UUID uid : regionFiles.keySet()) {
|
for (UUID uid : regionFiles.keySet()) {
|
||||||
HashMap<Long, mcMMOSimpleRegionFile> worldRegions = regionFiles.get(uid);
|
HashMap<Long, mcMMOSimpleRegionFile> worldRegions = regionFiles.get(uid);
|
||||||
Iterator<mcMMOSimpleRegionFile> itr = worldRegions.values().iterator();
|
Iterator<mcMMOSimpleRegionFile> itr = worldRegions.values().iterator();
|
||||||
@ -48,7 +48,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChunkStore readChunkStore(World world, int x, int z) throws IOException {
|
public synchronized ChunkStore readChunkStore(World world, int x, int z) throws IOException {
|
||||||
mcMMOSimpleRegionFile rf = getSimpleRegionFile(world, x, z);
|
mcMMOSimpleRegionFile rf = getSimpleRegionFile(world, x, z);
|
||||||
InputStream in = rf.getInputStream(x, z);
|
InputStream in = rf.getInputStream(x, z);
|
||||||
if (in == null) {
|
if (in == null) {
|
||||||
@ -75,7 +75,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeChunkStore(World world, int x, int z, ChunkStore data) {
|
public synchronized void writeChunkStore(World world, int x, int z, ChunkStore data) {
|
||||||
if (!data.isDirty()) {
|
if (!data.isDirty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -92,14 +92,14 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeChunkStore(World world, int x, int z) {
|
public synchronized void closeChunkStore(World world, int x, int z) {
|
||||||
mcMMOSimpleRegionFile rf = getSimpleRegionFile(world, x, z);
|
mcMMOSimpleRegionFile rf = getSimpleRegionFile(world, x, z);
|
||||||
if (rf != null) {
|
if (rf != null) {
|
||||||
rf.close();
|
rf.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private mcMMOSimpleRegionFile getSimpleRegionFile(World world, int x, int z) {
|
private synchronized mcMMOSimpleRegionFile getSimpleRegionFile(World world, int x, int z) {
|
||||||
File directory = new File(world.getWorldFolder(), "mcmmo_regions");
|
File directory = new File(world.getWorldFolder(), "mcmmo_regions");
|
||||||
|
|
||||||
directory.mkdirs();
|
directory.mkdirs();
|
||||||
@ -130,17 +130,17 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadChunklet(int cx, int cy, int cz, World world) {
|
public synchronized void loadChunklet(int cx, int cy, int cz, World world) {
|
||||||
loadChunk(cx, cz, world);
|
loadChunk(cx, cz, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unloadChunklet(int cx, int cy, int cz, World world) {
|
public synchronized void unloadChunklet(int cx, int cy, int cz, World world) {
|
||||||
unloadChunk(cx, cz, world);
|
unloadChunk(cx, cz, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadChunk(int cx, int cz, World world) {
|
public synchronized void loadChunk(int cx, int cz, World world) {
|
||||||
if(world == null)
|
if(world == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unloadChunk(int cx, int cz, World world) {
|
public synchronized void unloadChunk(int cx, int cz, World world) {
|
||||||
saveChunk(cx, cz, world);
|
saveChunk(cx, cz, world);
|
||||||
|
|
||||||
if(store.containsKey(world.getName() + "," + cx + "," + cz)) {
|
if(store.containsKey(world.getName() + "," + cx + "," + cz)) {
|
||||||
@ -169,7 +169,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveChunk(int cx, int cz, World world) {
|
public synchronized void saveChunk(int cx, int cz, World world) {
|
||||||
if(world == null)
|
if(world == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isChunkLoaded(int cx, int cz, World world) {
|
public synchronized boolean isChunkLoaded(int cx, int cz, World world) {
|
||||||
if(world == null)
|
if(world == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -192,10 +192,10 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void chunkLoaded(int cx, int cz, World world) {}
|
public synchronized void chunkLoaded(int cx, int cz, World world) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void chunkUnloaded(int cx, int cz, World world) {
|
public synchronized void chunkUnloaded(int cx, int cz, World world) {
|
||||||
if(world == null)
|
if(world == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveWorld(World world) {
|
public synchronized void saveWorld(World world) {
|
||||||
if(world == null)
|
if(world == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unloadWorld(World world) {
|
public synchronized void unloadWorld(World world) {
|
||||||
if(world == null)
|
if(world == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -255,10 +255,10 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadWorld(World world) {}
|
public synchronized void loadWorld(World world) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveAll() {
|
public synchronized void saveAll() {
|
||||||
closeAll();
|
closeAll();
|
||||||
|
|
||||||
for(World world : Bukkit.getWorlds()) {
|
for(World world : Bukkit.getWorlds()) {
|
||||||
@ -267,7 +267,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unloadAll() {
|
public synchronized void unloadAll() {
|
||||||
closeAll();
|
closeAll();
|
||||||
|
|
||||||
for(World world : Bukkit.getWorlds()) {
|
for(World world : Bukkit.getWorlds()) {
|
||||||
@ -276,7 +276,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTrue(int x, int y, int z, World world) {
|
public synchronized boolean isTrue(int x, int y, int z, World world) {
|
||||||
if(world == null)
|
if(world == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTrue(Block block) {
|
public synchronized boolean isTrue(Block block) {
|
||||||
if(block == null)
|
if(block == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTrue(int x, int y, int z, World world) {
|
public synchronized void setTrue(int x, int y, int z, World world) {
|
||||||
if(world == null)
|
if(world == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -335,7 +335,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTrue(Block block) {
|
public synchronized void setTrue(Block block) {
|
||||||
if(block == null)
|
if(block == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -343,7 +343,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFalse(int x, int y, int z, World world) {
|
public synchronized void setFalse(int x, int y, int z, World world) {
|
||||||
if(world == null)
|
if(world == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -369,7 +369,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFalse(Block block) {
|
public synchronized void setFalse(Block block) {
|
||||||
if(block == null)
|
if(block == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -377,9 +377,9 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cleanUp() {}
|
public synchronized void cleanUp() {}
|
||||||
|
|
||||||
public void convertChunk(File dataDir, int cx, int cz, World world) {
|
public synchronized void convertChunk(File dataDir, int cx, int cz, World world) {
|
||||||
if(!dataDir.exists()) return;
|
if(!dataDir.exists()) return;
|
||||||
File cxDir = new File(dataDir, "" + cx);
|
File cxDir = new File(dataDir, "" + cx);
|
||||||
if(!cxDir.exists()) return;
|
if(!cxDir.exists()) return;
|
||||||
@ -395,11 +395,9 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
if(converter.taskID >= 0)
|
if(converter.taskID >= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(conversionSet)
|
|
||||||
converters.remove(converter);
|
|
||||||
|
|
||||||
converter.start(world, cxDir, czDir);
|
converter.start(world, cxDir, czDir);
|
||||||
conversionSet = true;
|
conversionSet = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!conversionSet) {
|
if(!conversionSet) {
|
||||||
|
Loading…
Reference in New Issue
Block a user