WorldEdit should now support McRegion.

This commit is contained in:
sk89q
2011-03-10 00:21:45 -08:00
parent 49b4c190f9
commit 7df2ae4e11
4 changed files with 396 additions and 6 deletions

View File

@@ -58,17 +58,51 @@ public class Snapshot {
* @throws DataException
*/
public ChunkStore getChunkStore() throws IOException, DataException {
ChunkStore chunkStore = _getChunkStore();
logger.info("WorldEdit: Using " + chunkStore.getClass().getCanonicalName()
+ " for loading snapshot '" + file.getAbsolutePath() + "'");
return chunkStore;
}
/**
* Get a chunk store.
*
* @return
* @throws IOException
* @throws DataException
*/
public ChunkStore _getChunkStore() throws IOException, DataException {
if (file.getName().toLowerCase().endsWith(".zip")) {
try {
return new TrueZipLegacyChunkStore(file);
ChunkStore chunkStore = new TrueZipMcRegionChunkStore(file);
if (!chunkStore.isValid()) {
return new TrueZipLegacyChunkStore(file);
}
return chunkStore;
} catch (NoClassDefFoundError e) {
return new ZippedAlphaChunkStore(file);
ChunkStore chunkStore = new ZippedMcRegionChunkStore(file);
if (!chunkStore.isValid()) {
return new ZippedLegacyChunkStore(file);
}
return chunkStore;
}
} else if (file.getName().toLowerCase().endsWith(".tar.bz2")
|| file.getName().toLowerCase().endsWith(".tar.gz")
|| file.getName().toLowerCase().endsWith(".tar")) {
try {
return new TrueZipLegacyChunkStore(file);
ChunkStore chunkStore = new TrueZipMcRegionChunkStore(file);
if (!chunkStore.isValid()) {
return new TrueZipLegacyChunkStore(file);
}
return chunkStore;
} catch (NoClassDefFoundError e) {
throw new DataException("TrueZIP is required for .tar support");
}