13
0
geforkt von Mirrors/Paper

Make Anti-Xray Update Radius configurable (#1094)

Dieser Commit ist enthalten in:
stonar96 2018-04-22 16:45:56 +02:00 committet von Daniel Ennis
Ursprung 4316e8f59d
Commit 3340e81425
9 geänderte Dateien mit 128 neuen und 60 gelöschten Zeilen

Datei anzeigen

@ -1,11 +1,11 @@
From 8d22ff6f6f29ab5e7f2ab17f5166e92620c1c749 Mon Sep 17 00:00:00 2001
From 77ddf4aa9f419f854fbb51fdd390f5316d2d00cd Mon Sep 17 00:00:00 2001
From: stonar96 <minecraft.stonar96@gmail.com>
Date: Thu, 21 Sep 2017 00:38:47 +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 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
@@ -1,7 +1,10 @@
@ -19,7 +19,7 @@ index 7802cc1f..69fd8189 100644
import net.minecraft.server.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
@@ -426,4 +429,25 @@ public class PaperWorldConfig {
@@ -426,4 +429,27 @@ public class PaperWorldConfig {
disableCreeperLingeringEffect = getBoolean("disable-creeper-lingering-effect", false);
log("Creeper lingering effect: " + disableCreeperLingeringEffect);
}
@ -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,10 +91,10 @@ 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 +1,627 @@
@@ -0,0 +1,640 @@
+package com.destroystokyo.paper.antixray;
+
+import java.util.HashSet;
@ -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
@@ -35,6 +35,8 @@ import org.bukkit.generator.ChunkGenerator;
@ -1579,5 +1594,5 @@ index 9942f0c7..2da6edc6 100644
}
}
--
2.14.3
2.14.1.windows.1

Datei anzeigen

@ -1,16 +1,16 @@
From c65aa11566146474df22c01b4cbe1140d34f3858 Mon Sep 17 00:00:00 2001
From 06b4ff65646915cf98aa1c2370c2182a617ca5da Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 10 Nov 2017 23:03:12 -0500
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
@@ -450,4 +450,10 @@ public class PaperWorldConfig {
@@ -452,4 +452,10 @@ 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
@@ -1143,16 +1143,30 @@ public abstract class World implements IBlockAccess {
@ -56,5 +56,5 @@ index d45cbf2f..0193364d 100644
} // Spigot end
--
2.14.3
2.14.1.windows.1

Datei anzeigen

@ -1,4 +1,4 @@
From f0a620d88b20747060726bb0ffc329917aadaa12 Mon Sep 17 00:00:00 2001
From 8b7f2e2df1b19036d1b117a9771e2cfbfe7a51ba Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 1 Jan 2018 15:41:59 -0500
Subject: [PATCH] Configurable Chunks Sends per Tick setting
@ -8,10 +8,10 @@ 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
@@ -456,4 +456,13 @@ public class PaperWorldConfig {
@@ -458,4 +458,13 @@ public class PaperWorldConfig {
expMergeMaxValue = getInt("experience-merge-max-value", -1);
log("Experience Merge Max Value: " + expMergeMaxValue);
}
@ -39,5 +39,5 @@ index 4af55732..6ee9f6cf 100644
Iterator iterator2 = this.g.iterator();
--
2.14.3
2.14.1.windows.1

Datei anzeigen

@ -1,4 +1,4 @@
From 12a2b49cb2f955721aa6dfdb2edb2d04d5483426 Mon Sep 17 00:00:00 2001
From a154447f379d5f53108dfa6696d27dce53c51cc5 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 1 Jan 2018 16:10:24 -0500
Subject: [PATCH] Configurable Max Chunk Gens per Tick
@ -13,10 +13,10 @@ 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
@@ -465,4 +465,16 @@ public class PaperWorldConfig {
@@ -467,4 +467,16 @@ public class PaperWorldConfig {
}
log("Max Chunk Sends Per Tick: " + maxChunkSendsPerTick);
}
@ -108,5 +108,5 @@ index 193c3621..cf1258c5 100644
+ // Paper end
}
--
2.14.3
2.14.1.windows.1

Datei anzeigen

@ -1,4 +1,4 @@
From 84975cf3c2f9cff53bd8cfb2e6c99e6bf3c7bc36 Mon Sep 17 00:00:00 2001
From 14722028d518e9638b12c068990a7f12e6e76971 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 11 Jan 2018 16:47:28 -0600
Subject: [PATCH] Make max squid spawn height configurable
@ -7,10 +7,10 @@ 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
@@ -477,4 +477,9 @@ public class PaperWorldConfig {
@@ -479,4 +479,9 @@ public class PaperWorldConfig {
}
}
@ -36,5 +36,5 @@ index 0ce16be6..58a90283 100644
public void b(float f, float f1, float f2) {
--
2.14.3
2.14.1.windows.1

Datei anzeigen

@ -1,4 +1,4 @@
From a5b59c4a74ae629e213e85929baaf8c543fbef60 Mon Sep 17 00:00:00 2001
From ea2034c960ba8910596f61623ecfbea23568e907 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 27 Apr 2016 22:09:52 -0400
Subject: [PATCH] Optimize Hoppers
@ -11,10 +11,10 @@ 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
@@ -482,4 +482,12 @@ public class PaperWorldConfig {
@@ -484,4 +484,12 @@ public class PaperWorldConfig {
squidMaxSpawnHeight = getDouble("squid-spawn-height.maximum", 0.0D);
}
@ -280,5 +280,5 @@ index e9315f2d..5198a590 100644
flag = true;
} else if (a(itemstack1, itemstack)) {
--
2.14.3
2.14.1.windows.1

Datei anzeigen

@ -1,4 +1,4 @@
From 18bcec19deb1bbe364051ccdf83dd870047c8a20 Mon Sep 17 00:00:00 2001
From 2a9acabb8400a4e9b446057dbd4893491b68b9b6 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Sat, 14 Apr 2018 20:20:46 +0200
Subject: [PATCH] Configurable sprint interruption on attack
@ -6,10 +6,10 @@ 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
@@ -495,4 +495,9 @@ public class PaperWorldConfig {
@@ -497,4 +497,9 @@ public class PaperWorldConfig {
disableHopperMoveEvents = getBoolean("hopper.disable-move-event", disableHopperMoveEvents);
log("Hopper Move Item Events: " + (disableHopperMoveEvents ? "disabled" : "enabled"));
}
@ -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
@@ -1030,7 +1030,11 @@ public abstract class EntityHuman extends EntityLiving {
@ -37,5 +37,5 @@ index 35fde8b23..0b51903e2 100644
if (flag3) {
--
2.16.1.windows.1
2.14.1.windows.1

Datei anzeigen

@ -0,0 +1,28 @@
From 01a1624d8cb426581578ee90eac92d988cc9d19f 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
@@ -1754,7 +1754,7 @@ 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;
--
2.14.1.windows.1

Datei anzeigen

@ -0,0 +1,25 @@
From f731aff707b73a5aa7336f8dfbef087bf5668ef1 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
@@ -148,7 +148,7 @@ 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) {
--
2.14.1.windows.1