Config migrations

This commit is contained in:
Spottedleaf 2019-07-01 14:53:51 -07:00
parent 0a667728c8
commit e679a7c11d

View file

@ -1,11 +1,26 @@
From ca6f7c97ec5f1f366d5f42fe49360b8fc4dea510 Mon Sep 17 00:00:00 2001
From 5b18d35d10af4ba8c655f65dc378abf8c1d81c98 Mon Sep 17 00:00:00 2001
From: stonar96 <minecraft.stonar96@gmail.com>
Date: Mon, 20 Aug 2018 03:03:58 +0200
Subject: [PATCH] Anti-Xray
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 81987e4ad9..5942c3438e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -71,8 +71,8 @@ public class PaperConfig {
commands = new HashMap<String, Command>();
commands.put("paper", new PaperCommand("paper"));
- version = getInt("config-version", 18);
- set("config-version", 18);
+ version = getInt("config-version", 19);
+ set("config-version", 19);
readConfig(PaperConfig.class, null);
}
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 58109e1308..93d397d317 100644
index 58109e1308..b03d3ee84b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -1,7 +1,11 @@
@ -20,7 +35,7 @@ index 58109e1308..93d397d317 100644
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.spigotmc.SpigotWorldConfig;
@@ -509,4 +513,34 @@ public class PaperWorldConfig {
@@ -509,4 +513,43 @@ public class PaperWorldConfig {
private void maxAutoSaveChunksPerTick() {
maxAutoSaveChunksPerTick = getInt("max-auto-save-chunks-per-tick", 24);
}
@ -52,6 +67,15 @@ index 58109e1308..93d397d317 100644
+ updateRadius = getInt("anti-xray.update-radius", 2);
+ hiddenBlocks = getList("anti-xray.hidden-blocks", Arrays.asList("gold_ore", "iron_ore", "coal_ore", "lapis_ore", "mossy_cobblestone", "obsidian", "chest", "diamond_ore", "redstone_ore", "clay", "emerald_ore", "ender_chest"));
+ replacementBlocks = getList("anti-xray.replacement-blocks", Arrays.asList("stone", "oak_planks"));
+ if (PaperConfig.version < 19) {
+ hiddenBlocks.remove("lit_redstone_ore");
+ int index = replacementBlocks.indexOf("planks");
+ if (index != -1) {
+ replacementBlocks.set(index, "oak_planks");
+ }
+ set("anti-xray.hidden-blocks", hiddenBlocks);
+ set("anti-xray.replacement-blocks", replacementBlocks);
+ }
+ log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Chunk Edge Mode: " + chunkEdgeMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius);
+ }
}