mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
Make Anti-Xray Update Radius configurable (#1094)
This commit is contained in:
parent
5556eda6ba
commit
e2b2332062
9 changed files with 102 additions and 38 deletions
|
@ -5,7 +5,7 @@ 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 7802cc1f..69fd8189 100644
|
||||
index 7802cc1f..30307da0 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -29,6 +29,7 @@ index 7802cc1f..69fd8189 100644
|
|||
+ public EngineMode engineMode;
|
||||
+ public ChunkEdgeMode chunkEdgeMode;
|
||||
+ public int maxChunkSectionIndex;
|
||||
+ public int updateRadius;
|
||||
+ public List<Object> hiddenBlocks;
|
||||
+ public List<Object> replacementBlocks;
|
||||
+ private void antiXray() {
|
||||
|
@ -40,9 +41,10 @@ index 7802cc1f..69fd8189 100644
|
|||
+ chunkEdgeMode = chunkEdgeMode == null ? ChunkEdgeMode.DEFAULT : chunkEdgeMode;
|
||||
+ maxChunkSectionIndex = getInt("anti-xray.max-chunk-section-index", 3);
|
||||
+ maxChunkSectionIndex = maxChunkSectionIndex > 15 ? 15 : maxChunkSectionIndex;
|
||||
+ updateRadius = getInt("anti-xray.update-radius", 2);
|
||||
+ hiddenBlocks = getList("anti-xray.hidden-blocks", Arrays.asList((Object) "gold_ore", "iron_ore", "coal_ore", "lapis_ore", "mossy_cobblestone", "obsidian", "chest", "diamond_ore", "redstone_ore", "lit_redstone_ore", "clay", "emerald_ore", "ender_chest"));
|
||||
+ replacementBlocks = getList("anti-xray.replacement-blocks", Arrays.asList((Object) "stone", "planks"));
|
||||
+ log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Chunk Edge Mode: " + chunkEdgeMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks");
|
||||
+ log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Chunk Edge Mode: " + chunkEdgeMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java
|
||||
|
@ -89,7 +91,7 @@ index 00000000..6833cfad
|
|||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
|
||||
new file mode 100644
|
||||
index 00000000..91fa945f
|
||||
index 00000000..2dc0655a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -124,6 +126,7 @@ index 00000000..91fa945f
|
|||
+ private final EngineMode engineMode;
|
||||
+ private final ChunkEdgeMode chunkEdgeMode;
|
||||
+ private final int maxChunkSectionIndex;
|
||||
+ private final int updateRadius;
|
||||
+ private final IBlockData[] predefinedBlockData;
|
||||
+ private final IBlockData[] predefinedBlockDataStone;
|
||||
+ private final IBlockData[] predefinedBlockDataNetherrack;
|
||||
|
@ -142,6 +145,7 @@ index 00000000..91fa945f
|
|||
+ engineMode = paperWorldConfig.engineMode;
|
||||
+ chunkEdgeMode = paperWorldConfig.chunkEdgeMode;
|
||||
+ maxChunkSectionIndex = paperWorldConfig.maxChunkSectionIndex;
|
||||
+ updateRadius = paperWorldConfig.updateRadius;
|
||||
+
|
||||
+ if (asynchronous) {
|
||||
+ executorService = getExecutorServiceInstance();
|
||||
|
@ -618,31 +622,42 @@ index 00000000..91fa945f
|
|||
+
|
||||
+ @Override
|
||||
+ public void updateNearbyBlocks(World world, BlockPosition blockPosition) {
|
||||
+ BlockPosition temp = blockPosition.west();
|
||||
+ updateBlock(world, temp);
|
||||
+ updateBlock(world, temp.west());
|
||||
+ updateBlock(world, temp.down());
|
||||
+ updateBlock(world, temp.up());
|
||||
+ updateBlock(world, temp.north());
|
||||
+ updateBlock(world, temp.south());
|
||||
+ updateBlock(world, temp = blockPosition.east());
|
||||
+ updateBlock(world, temp.east());
|
||||
+ updateBlock(world, temp.down());
|
||||
+ updateBlock(world, temp.up());
|
||||
+ updateBlock(world, temp.north());
|
||||
+ updateBlock(world, temp.south());
|
||||
+ updateBlock(world, temp = blockPosition.down());
|
||||
+ updateBlock(world, temp.down());
|
||||
+ updateBlock(world, temp.north());
|
||||
+ updateBlock(world, temp.south());
|
||||
+ updateBlock(world, temp = blockPosition.up());
|
||||
+ updateBlock(world, temp.up());
|
||||
+ updateBlock(world, temp.north());
|
||||
+ updateBlock(world, temp.south());
|
||||
+ updateBlock(world, temp = blockPosition.north());
|
||||
+ updateBlock(world, temp.north());
|
||||
+ updateBlock(world, temp = blockPosition.south());
|
||||
+ updateBlock(world, temp.south());
|
||||
+ if (updateRadius >= 2) {
|
||||
+ BlockPosition temp = blockPosition.west();
|
||||
+ updateBlock(world, temp);
|
||||
+ updateBlock(world, temp.west());
|
||||
+ updateBlock(world, temp.down());
|
||||
+ updateBlock(world, temp.up());
|
||||
+ updateBlock(world, temp.north());
|
||||
+ updateBlock(world, temp.south());
|
||||
+ updateBlock(world, temp = blockPosition.east());
|
||||
+ updateBlock(world, temp.east());
|
||||
+ updateBlock(world, temp.down());
|
||||
+ updateBlock(world, temp.up());
|
||||
+ updateBlock(world, temp.north());
|
||||
+ updateBlock(world, temp.south());
|
||||
+ updateBlock(world, temp = blockPosition.down());
|
||||
+ updateBlock(world, temp.down());
|
||||
+ updateBlock(world, temp.north());
|
||||
+ updateBlock(world, temp.south());
|
||||
+ updateBlock(world, temp = blockPosition.up());
|
||||
+ updateBlock(world, temp.up());
|
||||
+ updateBlock(world, temp.north());
|
||||
+ updateBlock(world, temp.south());
|
||||
+ updateBlock(world, temp = blockPosition.north());
|
||||
+ updateBlock(world, temp.north());
|
||||
+ updateBlock(world, temp = blockPosition.south());
|
||||
+ updateBlock(world, temp.south());
|
||||
+ } else if (updateRadius == 1) {
|
||||
+ updateBlock(world, blockPosition.west());
|
||||
+ updateBlock(world, blockPosition.east());
|
||||
+ updateBlock(world, blockPosition.down());
|
||||
+ updateBlock(world, blockPosition.up());
|
||||
+ updateBlock(world, blockPosition.north());
|
||||
+ updateBlock(world, blockPosition.south());
|
||||
+ } else {
|
||||
+ //Do nothing if updateRadius <= 0 (test mode)
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void updateBlock(World world, BlockPosition blockPosition) {
|
||||
|
@ -1502,7 +1517,7 @@ index 8860a012..fa0d66d6 100644
|
|||
return this.a.size();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 00513d02..592e5b3b 100644
|
||||
index 137c2555..75d5451c 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.generator.ChunkGenerator;
|
||||
|
|
|
@ -8,7 +8,7 @@ Vanilla already had this limited, make it configurable.
|
|||
Limit how much exploration lags the server
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index e6ee13ee..8949b029 100644
|
||||
index a3119cd1..259f5c70 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
|
|
|
@ -13,7 +13,7 @@ This should result in no noticeable speed reduction in generation for servers no
|
|||
lagging, and let larger servers reduce this value according to their own desires.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 8949b029..cd036b44 100644
|
||||
index 259f5c70..3df3b433 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
|
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Configurable sprint interruption on attack
|
|||
If the sprint interruption is disabled players continue sprinting when they attack entities.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 038f874b3..c903c89cf 100644
|
||||
index 7a03f885..9ef2b163 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
|
@ -20,7 +20,7 @@ index 038f874b3..c903c89cf 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index 35fde8b23..0b51903e2 100644
|
||||
index 35fde8b2..0b51903e 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
|
|
@ -7,7 +7,7 @@ I don't know why upstream made only the minimum height configurable but
|
|||
whatever
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index cd036b44..1947f246 100644
|
||||
index 3df3b433..be4431c1 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
|
|
|
@ -11,7 +11,7 @@ Subject: [PATCH] Optimize Hoppers
|
|||
* Skip subsequent InventoryMoveItemEvents if a plugin does not use the item after first event fire for an iteration
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 1947f246..61cc1d4e 100644
|
||||
index be4431c1..9d2fe4a8 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
|
|
|
@ -5,12 +5,12 @@ Subject: [PATCH] Option for maximum exp value when merging orbs
|
|||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 69fd8189..e6ee13ee 100644
|
||||
index 30307da0..a3119cd1 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
replacementBlocks = getList("anti-xray.replacement-blocks", Arrays.asList((Object) "stone", "planks"));
|
||||
log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Chunk Edge Mode: " + chunkEdgeMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks");
|
||||
log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Chunk Edge Mode: " + chunkEdgeMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius);
|
||||
}
|
||||
+
|
||||
+ public int expMergeMaxValue;
|
||||
|
@ -20,7 +20,7 @@ index 69fd8189..e6ee13ee 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index d45cbf2f..0193364d 100644
|
||||
index a4bdaa71..362f0545 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 18 Apr 2018 01:42:42 -0400
|
||||
Subject: [PATCH] Revert SPIGOT-3894 to restore vanilla behavior
|
||||
|
||||
reporter of this issue was incorrect and did not verify vanilla logic
|
||||
|
||||
vanilla logic only skips ticks if the flag is set
|
||||
|
||||
spigots change causes bugs as it now skips ticking and processing
|
||||
chunk teleportation, which was a bug I fixed many many years ago...
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 4ce846b5..6c92f93a 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
// CraftBukkit end
|
||||
|
||||
// Spigot start
|
||||
- if (!org.spigotmc.ActivationRange.checkIfActive(entity)) {
|
||||
+ if (flag && !org.spigotmc.ActivationRange.checkIfActive(entity)) { // Paper - Revert spigot change back to vanilla
|
||||
entity.ticksLived++;
|
||||
entity.inactiveTick();
|
||||
return;
|
||||
--
|
|
@ -0,0 +1,23 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Sun, 8 Apr 2018 01:21:23 +0100
|
||||
Subject: [PATCH] revert "Better reloading of pending unload chunks"
|
||||
|
||||
many areas of NMS calls through to this method which means that
|
||||
the server can easilly keep chunks loaded in certain conditions
|
||||
even when they're no longer needed.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 55dada66..2ed3fc40 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
}
|
||||
|
||||
public Chunk getChunkAt(int i, int j, Runnable runnable, boolean generate) {
|
||||
- Chunk chunk = getLoadedChunkAt(i, j);
|
||||
+ Chunk chunk = getChunkIfLoaded(i, j); // Paper - revert "Better reloading of pending unload chunks" (see patch)
|
||||
ChunkRegionLoader loader = null;
|
||||
|
||||
if (this.chunkLoader instanceof ChunkRegionLoader) {
|
||||
--
|
Loading…
Reference in a new issue