mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-02 02:47:11 +00:00
Fixed snapshots not properly loading .mcr files, made snapshots use fast mode.
This commit is contained in:
parent
0d279e7706
commit
97380f28de
@ -42,7 +42,7 @@ public abstract class McRegionChunkStore extends ChunkStore {
|
||||
int x = pos.getBlockX();
|
||||
int z = pos.getBlockZ();
|
||||
|
||||
String filename = "r." + (x >> 5) + "." + (z >> 5) + ".mcr";
|
||||
String filename = "r." + (x >> 5) + "." + (z >> 5) + ".mca";
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
@ -100,21 +100,13 @@ public class TrueZipMcRegionChunkStore extends McRegionChunkStore {
|
||||
name = folder + "/" + name;
|
||||
}
|
||||
} else {
|
||||
Pattern pattern = Pattern.compile(".*\\.mcr$");
|
||||
Pattern patternmca = Pattern.compile(".*\\.mca$"); // TODO: does this need a separate class?
|
||||
Pattern pattern = Pattern.compile(".*\\.mc[ra]$");
|
||||
// World pattern
|
||||
Pattern worldPattern = Pattern.compile(worldname + "\\$");
|
||||
for (Enumeration<? extends ZipEntry> e = zip.entries(); e.hasMoreElements(); ) {
|
||||
ZipEntry testEntry = (ZipEntry) e.nextElement();
|
||||
// Check for world
|
||||
if (worldPattern.matcher(worldname).matches()) {
|
||||
// Check for file
|
||||
// TODO: does this need a separate class?
|
||||
if (patternmca.matcher(testEntry.getName()).matches()) {
|
||||
folder = testEntry.getName().substring(0, testEntry.getName().lastIndexOf("/"));
|
||||
name = folder + "/" + name.replace("mcr", "mca");
|
||||
break;
|
||||
}
|
||||
// Check for file
|
||||
if (pattern.matcher(testEntry.getName()).matches()) {
|
||||
folder = testEntry.getName().substring(0, testEntry.getName().lastIndexOf("/"));
|
||||
|
@ -98,19 +98,12 @@ public class ZippedMcRegionChunkStore extends McRegionChunkStore {
|
||||
name = folder + "/" + name;
|
||||
}
|
||||
} else {
|
||||
Pattern pattern = Pattern.compile(".*\\.mcr$");
|
||||
Pattern patternmca = Pattern.compile(".*\\.mca$"); // TODO: does this need a separate class?
|
||||
Pattern pattern = Pattern.compile(".*\\.mc[ra]$");
|
||||
for (Enumeration<? extends ZipEntry> e = zip.entries(); e.hasMoreElements(); ) {
|
||||
ZipEntry testEntry = (ZipEntry) e.nextElement();
|
||||
// Check for world
|
||||
if (testEntry.getName().startsWith(worldname + "/")) {
|
||||
// TODO: does this need a separate class?
|
||||
if (patternmca.matcher(testEntry.getName()).matches()) {
|
||||
folder = testEntry.getName().substring(0, testEntry.getName().lastIndexOf("/"));
|
||||
name = folder + "/" + name.replace("mcr", "mca");
|
||||
break;
|
||||
}
|
||||
if (pattern.matcher(testEntry.getName()).matches()) {
|
||||
if (pattern.matcher(testEntry.getName()).matches()) { // does entry end in .mca
|
||||
folder = testEntry.getName().substring(0, testEntry.getName().lastIndexOf("/"));
|
||||
name = folder + "/" + name;
|
||||
break;
|
||||
|
@ -155,6 +155,9 @@ public class SnapshotRestore {
|
||||
for (Map.Entry<BlockVector2D, ArrayList<Vector>> entry : neededChunks.entrySet()) {
|
||||
BlockVector2D chunkPos = entry.getKey();
|
||||
Chunk chunk;
|
||||
|
||||
boolean hasFastMode = editSession.hasFastMode();
|
||||
editSession.setFastMode(true);
|
||||
|
||||
try {
|
||||
chunk = chunkStore.getChunk(chunkPos, editSession.getWorld());
|
||||
@ -163,7 +166,7 @@ public class SnapshotRestore {
|
||||
// Now just copy blocks!
|
||||
for (Vector pos : entry.getValue()) {
|
||||
BaseBlock block = chunk.getBlock(pos);
|
||||
editSession.setBlock(pos, block);
|
||||
editSession.rawSetBlock(pos, block);
|
||||
}
|
||||
} catch (MissingChunkException me) {
|
||||
missingChunks.add(chunkPos);
|
||||
@ -176,6 +179,8 @@ public class SnapshotRestore {
|
||||
} catch (IOException ioe) {
|
||||
errorChunks.add(chunkPos);
|
||||
lastErrorMessage = ioe.getMessage();
|
||||
} finally {
|
||||
editSession.setFastMode(hasFastMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user