From 8017a346cb0c445d6b681867e9152881dbebea19 Mon Sep 17 00:00:00 2001 From: sk89q Date: Thu, 10 Mar 2011 00:26:01 -0800 Subject: [PATCH] Optimized the case when worlds were not in the root directory of a zip. --- src/com/sk89q/worldedit/data/TrueZipLegacyChunkStore.java | 5 +++-- src/com/sk89q/worldedit/data/TrueZipMcRegionChunkStore.java | 5 +++-- src/com/sk89q/worldedit/data/ZippedLegacyChunkStore.java | 5 +++-- src/com/sk89q/worldedit/data/ZippedMcRegionChunkStore.java | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/com/sk89q/worldedit/data/TrueZipLegacyChunkStore.java b/src/com/sk89q/worldedit/data/TrueZipLegacyChunkStore.java index 287a4a3ce..e0ec155f4 100644 --- a/src/com/sk89q/worldedit/data/TrueZipLegacyChunkStore.java +++ b/src/com/sk89q/worldedit/data/TrueZipLegacyChunkStore.java @@ -119,8 +119,9 @@ public class TrueZipLegacyChunkStore extends LegacyChunkStore { // Whoo, found level.dat! if (pattern.matcher(testEntry.getName()).matches()) { - file = testEntry.getName().replaceAll("level\\.dat$", "") - + file; + folder = testEntry.getName().replaceAll("level\\.dat$", ""); + folder = folder.substring(0, folder.length() - 1); + file = folder + file; break; } } diff --git a/src/com/sk89q/worldedit/data/TrueZipMcRegionChunkStore.java b/src/com/sk89q/worldedit/data/TrueZipMcRegionChunkStore.java index 43d54d683..b066d73d2 100644 --- a/src/com/sk89q/worldedit/data/TrueZipMcRegionChunkStore.java +++ b/src/com/sk89q/worldedit/data/TrueZipMcRegionChunkStore.java @@ -116,8 +116,9 @@ public class TrueZipMcRegionChunkStore extends McRegionChunkStore { // Whoo, found level.dat! if (pattern.matcher(testEntry.getName()).matches()) { - file = testEntry.getName().replaceAll("level\\.dat$", "") - + file; + folder = testEntry.getName().replaceAll("level\\.dat$", ""); + folder = folder.substring(0, folder.length() - 1); + file = folder + file; break; } } diff --git a/src/com/sk89q/worldedit/data/ZippedLegacyChunkStore.java b/src/com/sk89q/worldedit/data/ZippedLegacyChunkStore.java index 81754c2da..639c1e84c 100644 --- a/src/com/sk89q/worldedit/data/ZippedLegacyChunkStore.java +++ b/src/com/sk89q/worldedit/data/ZippedLegacyChunkStore.java @@ -116,8 +116,9 @@ public class ZippedLegacyChunkStore extends LegacyChunkStore { // Whoo, found level.dat! if (pattern.matcher(testEntry.getName()).matches()) { - file = testEntry.getName().replaceAll("level\\.dat$", "") - + file; + folder = testEntry.getName().replaceAll("level\\.dat$", ""); + folder = folder.substring(0, folder.length() - 1); + file = folder + file; break; } } diff --git a/src/com/sk89q/worldedit/data/ZippedMcRegionChunkStore.java b/src/com/sk89q/worldedit/data/ZippedMcRegionChunkStore.java index 045fd414e..124b43c02 100644 --- a/src/com/sk89q/worldedit/data/ZippedMcRegionChunkStore.java +++ b/src/com/sk89q/worldedit/data/ZippedMcRegionChunkStore.java @@ -113,8 +113,9 @@ public class ZippedMcRegionChunkStore extends McRegionChunkStore { // Whoo, found level.dat! if (pattern.matcher(testEntry.getName()).matches()) { - file = testEntry.getName().replaceAll("level\\.dat$", "") - + file; + folder = testEntry.getName().replaceAll("level\\.dat$", ""); + folder = folder.substring(0, folder.length() - 1); + file = folder + file; break; } }