mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Merge branch 'master' into fixes
This commit is contained in:
commit
e6e8c12735
@ -49,19 +49,4 @@ public class WorldListener implements Listener {
|
|||||||
public void onChunkUnload(ChunkUnloadEvent event) {
|
public void onChunkUnload(ChunkUnloadEvent event) {
|
||||||
mcMMO.placeStore.chunkUnloaded(event.getChunk().getX(), event.getChunk().getZ(), event.getWorld());
|
mcMMO.placeStore.chunkUnloaded(event.getChunk().getX(), event.getChunk().getZ(), event.getWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onChunkLoad(ChunkLoadEvent event) {
|
|
||||||
File dataDir = new File(event.getChunk().getWorld().getWorldFolder(), "mcmmo_data");
|
|
||||||
|
|
||||||
if(!dataDir.exists() || !dataDir.isDirectory()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
World world = event.getChunk().getWorld();
|
|
||||||
int cx = event.getChunk().getX();
|
|
||||||
int cz = event.getChunk().getZ();
|
|
||||||
|
|
||||||
((HashChunkManager) mcMMO.p.placeStore).convertChunk(dataDir, cx, cz, world);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import java.io.IOException;
|
|||||||
import java.io.ObjectInputStream;
|
import java.io.ObjectInputStream;
|
||||||
import java.io.ObjectOutputStream;
|
import java.io.ObjectOutputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.lang.Boolean;
|
||||||
import java.lang.Integer;
|
import java.lang.Integer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -30,6 +31,7 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
private HashMap<UUID, HashMap<Long, mcMMOSimpleRegionFile>> regionFiles = new HashMap<UUID, HashMap<Long, mcMMOSimpleRegionFile>>();
|
private HashMap<UUID, HashMap<Long, mcMMOSimpleRegionFile>> regionFiles = new HashMap<UUID, HashMap<Long, mcMMOSimpleRegionFile>>();
|
||||||
public HashMap<String, ChunkStore> store = new HashMap<String, ChunkStore>();
|
public HashMap<String, ChunkStore> store = new HashMap<String, ChunkStore>();
|
||||||
public ArrayList<BlockStoreConversionZDirectory> converters = new ArrayList<BlockStoreConversionZDirectory>();
|
public ArrayList<BlockStoreConversionZDirectory> converters = new ArrayList<BlockStoreConversionZDirectory>();
|
||||||
|
private HashMap<UUID, Boolean> oldData = new HashMap<UUID, Boolean>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void closeAll() {
|
public synchronized void closeAll() {
|
||||||
@ -149,9 +151,12 @@ public class HashChunkManager implements ChunkManager {
|
|||||||
|
|
||||||
ChunkStore in = null;
|
ChunkStore in = null;
|
||||||
|
|
||||||
File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
|
UUID key = world.getUID();
|
||||||
if(dataDir.exists())
|
if(!this.oldData.containsKey(key))
|
||||||
convertChunk(dataDir, cx, cz, world, true);
|
this.oldData.put(key, (new File(world.getWorldFolder(), "mcmmo_data")).exists());
|
||||||
|
|
||||||
|
if(this.oldData.containsKey(key) && oldData.get(key))
|
||||||
|
convertChunk(new File(world.getWorldFolder(), "mcmmo_data"), cx, cz, world, true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
in = readChunkStore(world, cx, cz);
|
in = readChunkStore(world, cx, cz);
|
||||||
|
Loading…
Reference in New Issue
Block a user