Auto detect world and datapack's encoding

This commit is contained in:
huanghongxun 2018-12-20 20:27:32 +08:00
parent b7723a88c3
commit fab5bdc2e1
2 changed files with 2 additions and 2 deletions

View File

@ -88,7 +88,7 @@ public class World {
}
private void loadFromZip() throws IOException {
try (FileSystem fs = CompressingUtils.createReadOnlyZipFileSystem(file)) {
try (FileSystem fs = CompressingUtils.readonly(file).setAutoDetectEncoding(true).build()) {
Path root = Files.list(fs.getPath("/")).filter(Files::isDirectory).findAny()
.orElseThrow(() -> new IOException("Not a valid world zip file"));

View File

@ -118,7 +118,7 @@ public class Datapack {
}
public void loadFromZip() throws IOException {
try (FileSystem fs = CompressingUtils.createReadOnlyZipFileSystem(path)) {
try (FileSystem fs = CompressingUtils.readonly(path).setAutoDetectEncoding(true).build()) {
Path datapacks = fs.getPath("/datapacks/");
Path mcmeta = fs.getPath("pack.mcmeta");
if (Files.exists(datapacks)) { // multiple datapacks