Fix ChunkPacketBlockControllerAntiXray initialize

This commit is contained in:
KennyTV 2021-06-15 16:07:27 +02:00
parent 68caddbb73
commit 7267c01db0
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
9 changed files with 33 additions and 26 deletions

View File

@ -11,7 +11,7 @@ I'm just here to watch you suffer :smile:
You can skip it if you want and I can do it later.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index e29566cad2647da4d9288e912188b57f00e8dd0c..51691d3dedf113d58f340b74d448c5e5375b5bed 100644
index e29566cad2647da4d9288e912188b57f00e8dd0c..edb9952ddd014c92b9604a9a187fdcd46de8a04f 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -1,7 +1,9 @@
@ -24,7 +24,7 @@ index e29566cad2647da4d9288e912188b57f00e8dd0c..51691d3dedf113d58f340b74d448c5e5
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.spigotmc.SpigotWorldConfig;
@@ -445,5 +447,39 @@ public class PaperWorldConfig {
@@ -445,5 +447,41 @@ public class PaperWorldConfig {
private void lightQueueSize() {
lightQueueSize = getInt("light-queue-size", lightQueueSize);
}
@ -46,7 +46,9 @@ index e29566cad2647da4d9288e912188b57f00e8dd0c..51691d3dedf113d58f340b74d448c5e5
+ updateRadius = getInt("anti-xray.update-radius", 2);
+ lavaObscures = getBoolean("anti-xray.lava-obscures", false);
+ usePermission = getBoolean("anti-xray.use-permission", false);
+ 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"));
+ hiddenBlocks = getList("anti-xray.hidden-blocks", Arrays.asList("copper_ore", "deepslate_copper_ore", "gold_ore", "deepslate_gold_ore", "iron_ore", "deepslate_iron_ore",
+ "coal_ore", "deepslate_coal_ore", "lapis_ore", "deepslate_lapis_ore", "mossy_cobblestone", "obsidian", "chest", "diamond_ore", "deepslate_diamond_ore",
+ "redstone_ore", "deepslate_redstone_ore", "clay", "emerald_ore", "deepslate_emerald_ore", "ender_chest"));
+ replacementBlocks = getList("anti-xray.replacement-blocks", Arrays.asList("stone", "oak_planks"));
+ if (PaperConfig.version < 19) {
+ hiddenBlocks.remove("lit_redstone_ore");
@ -66,7 +68,7 @@ index e29566cad2647da4d9288e912188b57f00e8dd0c..51691d3dedf113d58f340b74d448c5e5
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java
new file mode 100644
index 0000000000000000000000000000000000000000..fe1a91a3a281dd91e5989bf2282240b03684b500
index 0000000000000000000000000000000000000000..95d16cd708817534e5f2748f5da9c98c835392be
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java
@@ -0,0 +1,45 @@
@ -117,7 +119,7 @@ index 0000000000000000000000000000000000000000..fe1a91a3a281dd91e5989bf2282240b0
+}
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 0000000000000000000000000000000000000000..e1bc1093a03b931ff2c3870ea1601cd420f71192
index 0000000000000000000000000000000000000000..db95bde2a0bb17d13d0588dd0bbb81b7c5506345
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
@@ -0,0 +1,649 @@
@ -1157,7 +1159,7 @@ index f4a056185990181e486f452960159a5287947382..a695e5a0c2e8846333ccb9aea499b565
public void destroyAndAck(BlockPos pos, ServerboundPlayerActionPacket.Action action, String reason) {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index aa198e9f2755734eac591bd3f94679518e9d7270..687e3652d0f36a358a2348df845801ad82d8460c 100644
index aa198e9f2755734eac591bd3f94679518e9d7270..5c30d06ac80bb9e82d5eecf58b692040c3a55a99 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -164,6 +164,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -1168,7 +1170,7 @@ index aa198e9f2755734eac591bd3f94679518e9d7270..687e3652d0f36a358a2348df845801ad
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
public static BlockPos lastPhysicsProblem; // Spigot
@@ -185,9 +186,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -185,7 +186,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return this.typeKey;
}
@ -1176,12 +1178,17 @@ index aa198e9f2755734eac591bd3f94679518e9d7270..687e3652d0f36a358a2348df845801ad
+ protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), this.spigotConfig); // Paper
this.generator = gen;
@@ -258,6 +259,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
+ this.chunkPacketBlockController = this.paperConfig.antiXray ?
+ new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor)
+ : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
this.generator = gen;
this.world = new CraftWorld((ServerLevel) this, gen, env);
this.ticksPerAnimalSpawns = this.getCraftServer().getTicksPerAnimalSpawns(); // CraftBukkit
}
// Paper start
@@ -448,6 +452,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// CraftBukkit end

View File

@ -25,10 +25,10 @@ index fe79c0add4f7cb18d487c5bb9415c40c5b551ea2..8d9ddad1879e7616d980ca70de8aecac
poiUnload = Timings.ofSafe(name + "Chunk unload - POI");
chunkUnload = Timings.ofSafe(name + "Chunk unload - Chunk");
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 3f4a9ce31981f77b1c451a5d9ba91d6c9ab67587..a69efd1a21a667c5eee539f6c761755479375527 100644
index 1a21a177e3062130d7bbcde53e49732c634db73d..154866506a33cf2185891cd5051d51de9e2e4584 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -534,5 +534,10 @@ public class PaperWorldConfig {
@@ -536,5 +536,10 @@ public class PaperWorldConfig {
Bukkit.getLogger().warning("You have enabled permission-based Anti-Xray checking - depending on your permission plugin, this may cause performance issues");
}
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add toggle for always placing the dragon egg
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 214b7ab71c4717faa3c949e18f268bef3e066305..70fdd29f0dd6dfac94b2c20090348678a956c333 100644
index a001f5cd737cf5c76dc14b2b3442238adaa5f79e..2e5321e41ece132f61718816d8f16015cee9aadd 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -714,5 +714,10 @@ public class PaperWorldConfig {
@@ -716,5 +716,10 @@ public class PaperWorldConfig {
private void perPlayerMobSpawns() {
perPlayerMobSpawns = getBoolean("per-player-mob-spawns", false);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] added option to disable pathfinding updates on block changes
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 70fdd29f0dd6dfac94b2c20090348678a956c333..bc33cf47e6f67179656f9ac0c378408985d9a88e 100644
index 2e5321e41ece132f61718816d8f16015cee9aadd..9b507c67d12b9117671d31b9b1581764b93233ba 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -719,5 +719,10 @@ public class PaperWorldConfig {
@@ -721,5 +721,10 @@ public class PaperWorldConfig {
private void enderDragonsDeathAlwaysPlacesDragonEgg() {
enderDragonsDeathAlwaysPlacesDragonEgg = getBoolean("ender-dragons-death-always-places-dragon-egg", enderDragonsDeathAlwaysPlacesDragonEgg);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] MC-29274: Fix Wither hostility towards players
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index bc33cf47e6f67179656f9ac0c378408985d9a88e..f97795330cff2df87c91a0946b80d156d1df9389 100644
index 9b507c67d12b9117671d31b9b1581764b93233ba..7ef033def7bf5bfc7b9f054e3c4dd9914a0d2146 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -724,5 +724,11 @@ public class PaperWorldConfig {
@@ -726,5 +726,11 @@ public class PaperWorldConfig {
private void setUpdatePathfindingOnBlockUpdate() {
updatePathfindingOnBlockUpdate = getBoolean("update-pathfinding-on-block-update", this.updatePathfindingOnBlockUpdate);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Allow using signs inside spawn protection
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index f97795330cff2df87c91a0946b80d156d1df9389..19a0b2a73ab1d066501148108d6cd9998d281853 100644
index 7ef033def7bf5bfc7b9f054e3c4dd9914a0d2146..c0e4f56dc0d17322ab1ea8923f9f215e2eaa210f 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -730,5 +730,10 @@ public class PaperWorldConfig {
@@ -732,5 +732,10 @@ public class PaperWorldConfig {
fixWitherTargetingBug = getBoolean("fix-wither-targeting-bug", false);
log("Withers properly target players: " + fixWitherTargetingBug);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Limit item frame cursors on maps
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 19a0b2a73ab1d066501148108d6cd9998d281853..0fef75148df251d76a029e86a345adad039fcdd0 100644
index c0e4f56dc0d17322ab1ea8923f9f215e2eaa210f..1e55e6338a7e41c238170837fa03eeb3d909fa08 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -735,5 +735,10 @@ public class PaperWorldConfig {
@@ -737,5 +737,10 @@ public class PaperWorldConfig {
private void allowUsingSignsInsideSpawnProtection() {
allowUsingSignsInsideSpawnProtection = getBoolean("allow-using-signs-inside-spawn-protection", allowUsingSignsInsideSpawnProtection);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add option to fix items merging through walls
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0fef75148df251d76a029e86a345adad039fcdd0..57929ffa8e992874089ee30d8a96eeb03d754816 100644
index 1e55e6338a7e41c238170837fa03eeb3d909fa08..7777ff1677a207adfb48f2f227b854cfcade0373 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -740,5 +740,10 @@ public class PaperWorldConfig {
@@ -742,5 +742,10 @@ public class PaperWorldConfig {
private void mapItemFrameCursorLimit() {
mapItemFrameCursorLimit = getInt("map-item-frame-cursor-limit", mapItemFrameCursorLimit);
}

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Fix invulnerable end crystals
MC-108513
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 57929ffa8e992874089ee30d8a96eeb03d754816..31be320d7d4cf8659d2d4281186b3f0d424a99e1 100644
index 7777ff1677a207adfb48f2f227b854cfcade0373..43ab68f1822e92973e57a40f63376b467df3bdc7 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -745,5 +745,10 @@ public class PaperWorldConfig {
@@ -747,5 +747,10 @@ public class PaperWorldConfig {
private void fixItemsMergingThroughWalls() {
fixItemsMergingThroughWalls = getBoolean("fix-items-merging-through-walls", fixItemsMergingThroughWalls);
}