diff --git a/Spigot-Server-Patches/Anti-Xray.patch b/Spigot-Server-Patches/Anti-Xray.patch index 8c191317bc..f48c61b04e 100644 --- a/Spigot-Server-Patches/Anti-Xray.patch +++ b/Spigot-Server-Patches/Anti-Xray.patch @@ -28,6 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public int maxChunkSectionIndex; + public int updateRadius; + public boolean lavaObscures; ++ public boolean usePermission; + public List hiddenBlocks; + public List replacementBlocks; + private void antiXray() { @@ -38,6 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + maxChunkSectionIndex = maxChunkSectionIndex > 15 ? 15 : maxChunkSectionIndex; + 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")); + replacementBlocks = getList("anti-xray.replacement-blocks", Arrays.asList("stone", "oak_planks")); + if (PaperConfig.version < 19) { @@ -50,6 +52,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + set("anti-xray.replacement-blocks", replacementBlocks); + } + log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius); ++ if (antiXray && usePermission) { ++ Bukkit.getLogger().warning("You have enabled permission-based Anti-Xray checking - depending on your permission plugin, this may cause performance issues"); ++ } + } } diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java @@ -63,6 +68,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import net.minecraft.server.BlockPosition; +import net.minecraft.server.Chunk; +import net.minecraft.server.ChunkSection; ++import net.minecraft.server.EntityPlayer; +import net.minecraft.server.EnumDirection; +import net.minecraft.server.IBlockData; +import net.minecraft.server.IChunkAccess; @@ -82,6 +88,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return null; + } + ++ public boolean shouldModify(EntityPlayer entityPlayer, Chunk chunk, int chunkSectionSelector) { ++ return false; ++ } ++ + public ChunkPacketInfo getChunkPacketInfo(PacketPlayOutMapChunk packetPlayOutMapChunk, Chunk chunk, int chunkSectionSelector) { + return null; + } @@ -127,6 +137,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private final EngineMode engineMode; + private final int maxChunkSectionIndex; + private final int updateRadius; ++ private final boolean usePermission; + private final IBlockData[] predefinedBlockData; + private final IBlockData[] predefinedBlockDataFull; + private final IBlockData[] predefinedBlockDataStone; @@ -146,6 +157,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + engineMode = paperWorldConfig.engineMode; + maxChunkSectionIndex = paperWorldConfig.maxChunkSectionIndex; + updateRadius = paperWorldConfig.updateRadius; ++ usePermission = paperWorldConfig.usePermission; + + this.executor = executor; + @@ -248,6 +260,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + @Override ++ public boolean shouldModify(EntityPlayer entityPlayer, Chunk chunk, int chunkSectionSelector) { ++ return !usePermission || !entityPlayer.getBukkitEntity().hasPermission("paper.antixray.bypass"); ++ } ++ ++ @Override + public ChunkPacketInfoAntiXray getChunkPacketInfo(PacketPlayOutMapChunk packetPlayOutMapChunk, Chunk chunk, int chunkSectionSelector) { + // Return a new instance to collect data and objects in the right state while creating the chunk packet for thread safe access later + // Note: As of 1.14 this has to be moved later due to the chunk system. @@ -257,6 +274,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @Override + public void modifyBlocks(PacketPlayOutMapChunk packetPlayOutMapChunk, ChunkPacketInfo chunkPacketInfo) { ++ if (chunkPacketInfo == null) { ++ packetPlayOutMapChunk.setReady(true); ++ return; ++ } ++ + if (!Bukkit.isPrimaryThread()) { + // plugins? + MinecraftServer.getServer().scheduleOnMain(() -> { @@ -1237,10 +1259,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private final java.util.List extraPackets = new java.util.ArrayList<>(); private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750); @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet { + return extraPackets; } // Paper end - public PacketPlayOutMapChunk(Chunk chunk, int i) { -+ ChunkPacketInfo chunkPacketInfo = chunk.world.chunkPacketBlockController.getChunkPacketInfo(this, chunk, i); // Paper - Anti-Xray - Add chunk packet info +- public PacketPlayOutMapChunk(Chunk chunk, int i) { ++ // Paper start - Anti-Xray - Add chunk packet info ++ @Deprecated public PacketPlayOutMapChunk(Chunk chunk, int i) { this(chunk, i, true); } // Notice for updates: Please make sure this constructor isn't used anywhere ++ public PacketPlayOutMapChunk(Chunk chunk, int i, boolean modifyBlocks) { ++ ChunkPacketInfo chunkPacketInfo = modifyBlocks ? chunk.world.chunkPacketBlockController.getChunkPacketInfo(this, chunk, i) : null; ++ // Paper end ChunkCoordIntPair chunkcoordintpair = chunk.getPos(); this.a = chunkcoordintpair.x; @@ -1315,6 +1342,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 }, this.executor); } +@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + + } + ++ private final void sendChunk(EntityPlayer entityplayer, Packet[] apacket, Chunk chunk) { this.a(entityplayer, apacket, chunk); } // Paper - OBFHELPER + private void a(EntityPlayer entityplayer, Packet[] apacket, Chunk chunk) { + if (apacket[0] == null) { +- apacket[0] = new PacketPlayOutMapChunk(chunk, 65535); ++ apacket[0] = new PacketPlayOutMapChunk(chunk, 65535, chunk.world.chunkPacketBlockController.shouldModify(entityplayer, chunk, 65535)); // Paper - Anti-Xray - Bypass + apacket[1] = new PacketPlayOutLightUpdate(chunk.getPos(), this.lightEngine, true); + } + diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java diff --git a/Spigot-Server-Patches/Configurable-projectile-relative-velocity.patch b/Spigot-Server-Patches/Configurable-projectile-relative-velocity.patch index fdef2c3315..8ace9e0ee2 100644 --- a/Spigot-Server-Patches/Configurable-projectile-relative-velocity.patch +++ b/Spigot-Server-Patches/Configurable-projectile-relative-velocity.patch @@ -29,8 +29,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- 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 { + Bukkit.getLogger().warning("You have enabled permission-based Anti-Xray checking - depending on your permission plugin, this may cause performance issues"); } - log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius); } + + public boolean disableRelativeProjectileVelocity; diff --git a/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch b/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch index 8a1e3872a3..6c085fcd4d 100644 --- a/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch +++ b/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch @@ -562,10 +562,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } +- private final void sendChunk(EntityPlayer entityplayer, Packet[] apacket, Chunk chunk) { this.a(entityplayer, apacket, chunk); } // Paper - OBFHELPER + final void sendChunk(EntityPlayer entityplayer, Packet[] apacket, Chunk chunk) { this.a(entityplayer, apacket, chunk); } // Paper - OBFHELPER private void a(EntityPlayer entityplayer, Packet[] apacket, Chunk chunk) { if (apacket[0] == null) { - apacket[0] = new PacketPlayOutMapChunk(chunk, 65535); + apacket[0] = new PacketPlayOutMapChunk(chunk, 65535, chunk.world.chunkPacketBlockController.shouldModify(entityplayer, chunk, 65535)); // Paper - Anti-Xray - Bypass @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(this.tracker.chunkX, this.tracker.chunkZ); PlayerChunk playerchunk = PlayerChunkMap.this.getVisibleChunk(chunkcoordintpair.pair()); diff --git a/Spigot-Server-Patches/Workaround-for-Client-Lag-Spikes-MC-162253.patch b/Spigot-Server-Patches/Workaround-for-Client-Lag-Spikes-MC-162253.patch index f1d6011e4a..d10c7a6690 100644 --- a/Spigot-Server-Patches/Workaround-for-Client-Lag-Spikes-MC-162253.patch +++ b/Spigot-Server-Patches/Workaround-for-Client-Lag-Spikes-MC-162253.patch @@ -93,7 +93,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + apacket = new Packet[10]; + } + // Paper end - apacket[0] = new PacketPlayOutMapChunk(chunk, 65535); + apacket[0] = new PacketPlayOutMapChunk(chunk, 65535, chunk.world.chunkPacketBlockController.shouldModify(entityplayer, chunk, 65535)); // Paper - Anti-Xray - Bypass apacket[1] = new PacketPlayOutLightUpdate(chunk.getPos(), this.lightEngine, true); + + // Paper start - Fix MC-162253