77 lines
4.4 KiB
Diff
77 lines
4.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
|
Date: Fri, 10 Feb 2023 20:03:58 +0200
|
|
Subject: [PATCH] Kaiiju RegionFormat Configuration
|
|
|
|
|
|
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
|
index dd4c3ca77acb3aeefc69b8eb948b8b202ff87a19..1b180af49adee16c2d8305d01cf213322c4d721b 100644
|
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
|
@@ -4,9 +4,11 @@ import org.apache.commons.lang.BooleanUtils;
|
|
import org.bukkit.World;
|
|
import org.bukkit.configuration.ConfigurationSection;
|
|
|
|
+import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.function.Predicate;
|
|
+import java.util.logging.Level;
|
|
|
|
import static dev.kaiijumc.kaiiju.KaiijuConfig.log;
|
|
|
|
@@ -122,4 +124,30 @@ public class KaiijuWorldConfig {
|
|
final Map<String, Object> value = getMap("world-settings." + worldName + "." + path, null);
|
|
return value.isEmpty() ? fallback : value;
|
|
}
|
|
+
|
|
+ public List<String> regionFormatList = Arrays.asList("ANVIL", "LINEAR");
|
|
+ public String regionFormatName = "ANVIL";
|
|
+ public int regionFormatLinearCompressionLevel = 1;
|
|
+ public int regionFormatLinearInternalCompressionLevel = 1;
|
|
+
|
|
+ private void regionFormatSettings() {
|
|
+ regionFormatName = getString("region-format.format", regionFormatName).toUpperCase();
|
|
+ if (!regionFormatList.contains(regionFormatName)) {
|
|
+ log(Level.SEVERE, "Unknown region format in kaiiju.yml: " + regionFormatName);
|
|
+ log(Level.SEVERE, "Falling back to ANVIL region file format.");
|
|
+ regionFormatName = "ANVIL";
|
|
+ }
|
|
+ regionFormatLinearCompressionLevel = getInt("region-format.linear.compression-level", regionFormatLinearCompressionLevel);
|
|
+ regionFormatLinearInternalCompressionLevel = getInt("region-format.linear.internal-compression-level", regionFormatLinearInternalCompressionLevel);
|
|
+ if (regionFormatLinearCompressionLevel > 23 || regionFormatLinearCompressionLevel < 1) {
|
|
+ log(Level.SEVERE, "Linear region compression level should be between 1 and 22 in kaiiju.yml: " + regionFormatLinearCompressionLevel);
|
|
+ log(Level.SEVERE, "Falling back to compression level 1.");
|
|
+ regionFormatLinearCompressionLevel = 1;
|
|
+ }
|
|
+ if (regionFormatLinearInternalCompressionLevel > 23 || regionFormatLinearInternalCompressionLevel < 1) {
|
|
+ log(Level.SEVERE, "Linear region compression level should be between 1 and 22 in kaiiju.yml: " + regionFormatLinearCompressionLevel);
|
|
+ log(Level.SEVERE, "Falling back to compression level 1.");
|
|
+ regionFormatLinearCompressionLevel = 1;
|
|
+ }
|
|
+ }
|
|
}
|
|
\ No newline at end of file
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index c1b88ae704b3d2b8ebbad28c0291a4ad12e6d5d9..ae4dd7db4e4e32fe8100309d770307fccf31110d 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -855,7 +855,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
// Paper start - rewrite chunk system
|
|
worldserver.save((ProgressListener) null, flush, worldserver.noSave && !force, close);
|
|
if (flush) {
|
|
- MinecraftServer.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", worldserver.getChunkSource().chunkMap.getStorageName());
|
|
+ MinecraftServer.LOGGER.info("ThreadedChunkStorage ({}): All chunks are saved", worldserver.getChunkSource().chunkMap.getStorageName()); // Kaiiju
|
|
}
|
|
// Paper end - rewrite chunk system
|
|
}
|
|
@@ -879,7 +879,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
//MinecraftServer.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", worldserver2.getChunkSource().chunkMap.getStorageName()); // Paper - move up
|
|
}
|
|
|
|
- MinecraftServer.LOGGER.info("ThreadedAnvilChunkStorage: All dimensions are saved");
|
|
+ MinecraftServer.LOGGER.info("ThreadedChunkStorage: All dimensions are saved"); // Kaiiju
|
|
}
|
|
|
|
return flag3;
|