Make anti-xray chunk edge mode LOAD the default

Fixes GH-1749

Setting the new default to load chunk edge neighbors may have unintended
side-effects so feedback will be important. Specifically, if you're not
using the asynchronous chunk loader, you should probably switch to mode
2 (WAIT)

Old users will be migrated automatically if: You're using engine mode 1
(HIDE) and you're using chunk-edge-mode 1 (DEFAULT). Other users will
not be migrated.

Thanks @stonar96
This commit is contained in:
Zach Brown 2019-01-12 18:06:26 -05:00
parent a5e0335065
commit 21ba01aaf4
No known key found for this signature in database
GPG key ID: CC9DA35FC5450B76
4 changed files with 27 additions and 20 deletions

View file

@ -1,4 +1,4 @@
From adc03c34bceae0b048f7b8fa4e32c9aa42eda25a Mon Sep 17 00:00:00 2001
From 567d98f00316e16d3b6f160192698352e97371aa Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Mon, 29 Feb 2016 21:02:09 -0600
Subject: [PATCH] Paper config files
@ -249,7 +249,7 @@ index 000000000..961966e16
+}
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
new file mode 100644
index 000000000..f0473d9bf
index 000000000..5586575ce
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -0,0 +1,184 @@
@ -314,8 +314,8 @@ index 000000000..f0473d9bf
+ commands = new HashMap<String, Command>();
+ commands.put("paper", new PaperCommand("paper"));
+
+ version = getInt("config-version", 16);
+ set("config-version", 16);
+ version = getInt("config-version", 17);
+ set("config-version", 17);
+ readConfig(PaperConfig.class, null);
+ }
+
@ -511,7 +511,7 @@ index 000000000..a73865739
+ }
+}
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 229c25338..197d116c6 100644
index 64a6a681f..ad9c00bc8 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -192,6 +192,15 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@ -531,7 +531,7 @@ index 229c25338..197d116c6 100644
DedicatedServer.LOGGER.info("Generating keypair");
this.a(MinecraftEncryption.b());
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 5289325a2..b1a4a6d70 100644
index 9ebafa6b9..0fac63db0 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -133,9 +133,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener {
@ -593,7 +593,7 @@ index 6ea9eaa1a..5531f5205 100644
this.world = new CraftWorld((WorldServer) this, gen, env);
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index aa0dfa4cc..a3c07fbac 100644
index fc49882c2..f31b18dd2 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -753,6 +753,7 @@ public final class CraftServer implements Server {

View file

@ -1,11 +1,11 @@
From 8d82fb498c5cf89a1a40ee1c8066ad25caec3375 Mon Sep 17 00:00:00 2001
From b6628d091b2d03a1d0587efb1acda26524e2a88d 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/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 6feea98b6..2220a18d9 100644
index 6feea98b6..2a0aa2d6d 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -1,7 +1,10 @@
@ -19,7 +19,7 @@ index 6feea98b6..2220a18d9 100644
import net.minecraft.server.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
@@ -513,4 +516,27 @@ public class PaperWorldConfig {
@@ -513,4 +516,34 @@ public class PaperWorldConfig {
this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick);
log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default");
}
@ -37,8 +37,15 @@ index 6feea98b6..2220a18d9 100644
+ asynchronous = true;
+ engineMode = EngineMode.getById(getInt("anti-xray.engine-mode", EngineMode.HIDE.getId()));
+ engineMode = engineMode == null ? EngineMode.HIDE : engineMode;
+ chunkEdgeMode = ChunkEdgeMode.getById(getInt("anti-xray.chunk-edge-mode", ChunkEdgeMode.DEFAULT.getId()));
+ chunkEdgeMode = ChunkEdgeMode.getById(getInt("anti-xray.chunk-edge-mode", ChunkEdgeMode.LOAD.getId()));
+ chunkEdgeMode = chunkEdgeMode == null ? ChunkEdgeMode.DEFAULT : chunkEdgeMode;
+
+ if (PaperConfig.version < 17 && engineMode == EngineMode.HIDE && chunkEdgeMode == ChunkEdgeMode.DEFAULT) {
+ set("anti-xray.chunk-edge-mode", ChunkEdgeMode.LOAD.getId());
+ chunkEdgeMode = ChunkEdgeMode.LOAD;
+ log("Migrating Anti-Xray engine mode to mode 3 (LOAD)");
+ }
+
+ maxChunkSectionIndex = getInt("anti-xray.max-chunk-section-index", 3);
+ maxChunkSectionIndex = maxChunkSectionIndex > 15 ? 15 : maxChunkSectionIndex;
+ updateRadius = getInt("anti-xray.update-radius", 2);
@ -1071,7 +1078,7 @@ index edf4d9130..71d865b76 100644
this.initLighting();
}
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 829cc9ed8..18c06d3c8 100644
index 60143ff63..d938eb374 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -849,7 +849,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
@ -1452,7 +1459,7 @@ index 7d3f846a1..240f59066 100644
} else {
this.a((Packet) (new PacketPlayOutMultiBlockChange(this.dirtyCount, this.dirtyBlocks, this.chunk)));
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index c884fcd34..1d76c4c99 100644
index ef0b03795..cf5392311 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -207,6 +207,8 @@ public class PlayerInteractManager {

View file

@ -1,4 +1,4 @@
From 6a82bca7e80c2fcde22d2fba3a1d399e73201b98 Mon Sep 17 00:00:00 2001
From b56464eae03f77828a947abd8cb7afdf93ad4aed Mon Sep 17 00:00:00 2001
From: Gabriele C <sgdc3.mail@gmail.com>
Date: Mon, 22 Oct 2018 17:34:10 +0200
Subject: [PATCH] Add option to prevent players from moving into unloaded
@ -6,10 +6,10 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 48920b045..77368b17a 100644
index 575281991..f47a648af 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -567,4 +567,9 @@ public class PaperWorldConfig {
@@ -574,4 +574,9 @@ public class PaperWorldConfig {
replacementBlocks = getList("anti-xray.replacement-blocks", Arrays.asList("stone", "planks"));
log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Chunk Edge Mode: " + chunkEdgeMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius);
}
@ -20,7 +20,7 @@ index 48920b045..77368b17a 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 8899ad0f6..f78c6e991 100644
index 0bcb9c1ab..c1f47701c 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -341,6 +341,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {

View file

@ -1,4 +1,4 @@
From 15da3a5b2cb9ff0d4cef5d44df0938d879271aad Mon Sep 17 00:00:00 2001
From 8f9fb49ad68cc9a5482ff0c2c1be8b1f4579f079 Mon Sep 17 00:00:00 2001
From: theosib <millerti@172.16.221.1>
Date: Thu, 27 Sep 2018 01:43:35 -0600
Subject: [PATCH] Optimize redstone algorithm
@ -19,10 +19,10 @@ Aside from making the obvious class/function renames and obfhelpers I didn't nee
Just added Bukkit's event system and took a few liberties with dead code and comment misspellings.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 77368b17a..5981a5f51 100644
index f47a648af..eefbb355d 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -572,4 +572,14 @@ public class PaperWorldConfig {
@@ -579,4 +579,14 @@ public class PaperWorldConfig {
private void preventMovingIntoUnloadedChunks() {
preventMovingIntoUnloadedChunks = getBoolean("prevent-moving-into-unloaded-chunks", false);
}