From 12efc3fcf586c2ea422d3a29b9266a9023031e0f Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Mon, 28 Feb 2022 21:34:23 +0100 Subject: [PATCH] Fixes --- patches/server/0007-Not-implemeneted.patch | 4 ++-- .../server/0054-Add-velocity-warnings.patch | 4 ++-- patches/server/0360-Anti-Xray.patch | 19 ++++++------------- ...7-Added-ServerResourcesReloadedEvent.patch | 9 ++++----- ...telist-use-configurable-kick-message.patch | 4 ++-- ...x-and-optimise-world-force-upgrading.patch | 4 ++-- .../0660-Add-Unix-domain-socket-support.patch | 10 +++++----- .../0666-Add-PlayerKickEvent-causes.patch | 4 ++-- .../0749-Execute-chunk-tasks-mid-tick.patch | 4 ++-- ...single-and-multi-AABB-VoxelShapes-an.patch | 6 +++--- ...t-isSectionEmpty-int-and-optimize-Pa.patch | 19 ++++++------------- patches/server/0871-Custom-Potion-Mixes.patch | 4 ++-- 12 files changed, 38 insertions(+), 53 deletions(-) diff --git a/patches/server/0007-Not-implemeneted.patch b/patches/server/0007-Not-implemeneted.patch index 4c0c7c371b..8820930234 100644 --- a/patches/server/0007-Not-implemeneted.patch +++ b/patches/server/0007-Not-implemeneted.patch @@ -7,7 +7,7 @@ Currently a placeholder patch. diff --git a/src/main/java/io/papermc/paper/util/TickThread.java b/src/main/java/io/papermc/paper/util/TickThread.java new file mode 100644 -index 0000000000000000000000000000000000000000..728c39bb163b2334da9915441fd46970b16cf2a9 +index 0000000000000000000000000000000000000000..c92f7e59f490f7b289325d9cc2bf7c2cf1750c7a --- /dev/null +++ b/src/main/java/io/papermc/paper/util/TickThread.java @@ -0,0 +1,41 @@ @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..728c39bb163b2334da9915441fd46970 + + public static void ensureTickThread(final String reason) { + if (!Bukkit.isPrimaryThread()) { -+ MinecraftServer.LOGGER.fatal("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable()); ++ MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable()); + throw new IllegalStateException(reason); + } + } diff --git a/patches/server/0054-Add-velocity-warnings.patch b/patches/server/0054-Add-velocity-warnings.patch index d5a46d9485..944dc1e9f1 100644 --- a/patches/server/0054-Add-velocity-warnings.patch +++ b/patches/server/0054-Add-velocity-warnings.patch @@ -17,7 +17,7 @@ index 3fa2d14c67c211a7e145b02b84db84706e971761..02674288c62493c22e5e21b42a2d4386 static { ConfigurationSerialization.registerClass(CraftOfflinePlayer.class); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index fdbcf4989f72e1604a2841f565adfeebf8d45622..4ebd7609ec2bf62586feef4da7605dbb89569567 100644 +index fdbcf4989f72e1604a2841f565adfeebf8d45622..1e0b8314ef388763aa43055909e48778f0d421a3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -438,10 +438,40 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -25,7 +25,7 @@ index fdbcf4989f72e1604a2841f565adfeebf8d45622..4ebd7609ec2bf62586feef4da7605dbb Preconditions.checkArgument(velocity != null, "velocity"); velocity.checkFinite(); + // Paper start - Warn server owners when plugins try to set super high velocities -+ if (!(this instanceof org.bukkit.entity.Projectile) && isUnsafeVelocity(velocity)) { ++ if (!(this instanceof org.bukkit.entity.Projectile || this instanceof org.bukkit.entity.Minecart) && isUnsafeVelocity(velocity)) { + CraftServer.excessiveVelEx = new Exception("Excessive velocity set detected: tried to set velocity of entity " + entity.getScoreboardName() + " id #" + getEntityId() + " to (" + velocity.getX() + "," + velocity.getY() + "," + velocity.getZ() + ")."); + } + // Paper end diff --git a/patches/server/0360-Anti-Xray.patch b/patches/server/0360-Anti-Xray.patch index f0e2d5d78d..e7953fb870 100644 --- a/patches/server/0360-Anti-Xray.patch +++ b/patches/server/0360-Anti-Xray.patch @@ -1565,7 +1565,7 @@ index 73d26c9eb902f19b0c3ffdd911898845277655b0..78058b505742541a484cadc790c445bd public static CompoundTag write(ServerLevel world, ChunkAccess chunk) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index f3c67a815c570beb14136905cbf5aa4046ee8394..ecab8b4d6850cf182c28869ecbdbc92d45fbe637 100644 +index f3c67a815c570beb14136905cbf5aa4046ee8394..87ece7f6dbd30f0b3b9d9673e22b6e72c092f067 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -53,7 +53,7 @@ public class CraftChunk implements Chunk { @@ -1577,28 +1577,21 @@ index f3c67a815c570beb14136905cbf5aa4046ee8394..ecab8b4d6850cf182c28869ecbdbc92d private static final byte[] emptyLight = new byte[2048]; public CraftChunk(net.minecraft.world.level.chunk.LevelChunk chunk) { -@@ -326,7 +326,11 @@ public class CraftChunk implements Chunk { +@@ -326,7 +326,7 @@ public class CraftChunk implements Chunk { PalettedContainer>[] biome = (includeBiome || includeBiomeTempRain) ? new PalettedContainer[cs.length] : null; Registry iregistry = this.worldServer.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); -+<<<<<<< HEAD - Codec>> biomeCodec = PalettedContainer.codec(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS)); -+======= +- Codec>> biomeCodec = PalettedContainer.codec(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS)); + Codec> biomeCodec = PalettedContainer.codec(iregistry, iregistry.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getOrThrow(Biomes.PLAINS), null); // Paper - Anti-Xray - Add preset biomes -+>>>>>>> Anti-Xray for (int i = 0; i < cs.length; i++) { CompoundTag data = new CompoundTag(); -@@ -391,7 +395,12 @@ public class CraftChunk implements Chunk { +@@ -391,7 +391,7 @@ public class CraftChunk implements Chunk { empty[i] = true; if (biome != null) { -+<<<<<<< HEAD - biome[i] = new PalettedContainer<>(iregistry.asHolderIdMap(), iregistry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); -+======= -+ Registry iregistry = world.getHandle().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); -+ biome[i] = new PalettedContainer<>(iregistry, iregistry.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES, null); // Paper - Anti-Xray - Add preset biomes -+>>>>>>> Anti-Xray +- biome[i] = new PalettedContainer<>(iregistry.asHolderIdMap(), iregistry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); ++ biome[i] = new PalettedContainer<>(iregistry.asHolderIdMap(), iregistry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES, null); // Paper - Anti-Xray - Add preset biomes } } diff --git a/patches/server/0567-Added-ServerResourcesReloadedEvent.patch b/patches/server/0567-Added-ServerResourcesReloadedEvent.patch index 5b9a96aefa..916d73cc30 100644 --- a/patches/server/0567-Added-ServerResourcesReloadedEvent.patch +++ b/patches/server/0567-Added-ServerResourcesReloadedEvent.patch @@ -5,25 +5,24 @@ Subject: [PATCH] Added ServerResourcesReloadedEvent diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 1febf1e49f3ebe68c04efed2fd2da1ab1c6a900c..16ab255e5aba0d0975cf77ae70dca74cba767ad6 100644 +index 1febf1e49f3ebe68c04efed2fd2da1ab1c6a900c..0f03525066b818a81583618e9a80f245032493b7 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2006,8 +2006,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop reloadResources(Collection dataPacks) { -- RegistryAccess.Frozen iregistrycustom_dimension = this.registryAccess(); + return this.reloadResources(dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN); + } + public CompletableFuture reloadResources(Collection dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause cause) { + // Paper end + RegistryAccess.Frozen iregistrycustom_dimension = this.registryAccess(); CompletableFuture completablefuture = CompletableFuture.supplyAsync(() -> { Stream stream = dataPacks.stream(); // CraftBukkit - decompile error - PackRepository resourcepackrepository = this.packRepository; -@@ -2032,6 +2037,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop>[] biome = (includeBiome || includeBiomeTempRain) ? new PalettedContainer[cs.length] : null; -+<<<<<<< HEAD - Registry iregistry = this.worldServer.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); - <<<<<<< HEAD - Codec>> biomeCodec = PalettedContainer.codec(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS)); - ======= - Codec> biomeCodec = PalettedContainer.codec(iregistry, iregistry.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getOrThrow(Biomes.PLAINS), null); // Paper - Anti-Xray - Add preset biomes - >>>>>>> Anti-Xray -+======= -+>>>>>>> Fix ChunkSnapshot#isSectionEmpty(int) and optimize PalettedContainer copying by not using codecs - +- Registry iregistry = this.worldServer.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); +- Codec> biomeCodec = PalettedContainer.codec(iregistry, iregistry.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getOrThrow(Biomes.PLAINS), null); // Paper - Anti-Xray - Add preset biomes +- for (int i = 0; i < cs.length; i++) { - CompoundTag data = new CompoundTag(); @@ -39,7 +32,7 @@ index 5931e6a7bf57274c187db62de0482193557d572f..8579c4e632ace486c406bbbe1f6a6c79 LevelLightEngine lightengine = chunk.level.getLightEngine(); DataLayer skyLightArray = lightengine.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(x, i, z)); -@@ -311,8 +319,7 @@ public class CraftChunk implements Chunk { +@@ -307,8 +309,7 @@ public class CraftChunk implements Chunk { } if (biome != null) { diff --git a/patches/server/0871-Custom-Potion-Mixes.patch b/patches/server/0871-Custom-Potion-Mixes.patch index b9b964a96d..af6176c58b 100644 --- a/patches/server/0871-Custom-Potion-Mixes.patch +++ b/patches/server/0871-Custom-Potion-Mixes.patch @@ -24,10 +24,10 @@ index 0000000000000000000000000000000000000000..6b0bed550763f34e18c9e92f9a47ec0c + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 3bfc08e309a06b418d5e271747e25b29cbaa97e3..0dd1ae1a39e965abc46f40477f9203fe6ae230e6 100644 +index 66588f83024286efd04d408993113397d8bd1cfa..df0200600a3371ebc1974ef1219b06e46ef46424 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2059,6 +2059,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop