From f6fae41cdf18e3628d6d39a7d22cf678e3c8e330 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 26 Apr 2024 08:33:00 -0700 Subject: [PATCH] fix chat_type issue --- .../server/0003-Build-system-changes.patch | 60 ++++++++++++++++++- patches/server/0010-Adventure.patch | 4 +- patches/server/0694-Custom-Potion-Mixes.patch | 29 +++++---- ...n-on-world-create-while-being-ticked.patch | 2 +- ...ix-plugin-loggers-on-server-shutdown.patch | 2 +- ...x-premature-player-kicks-on-shutdown.patch | 2 +- ...Folia-scheduler-and-owned-region-API.patch | 2 +- ...ing-message-for-initial-server-start.patch | 2 +- .../server/0986-Rewrite-chunk-system.patch | 2 +- ...-incremental-chunk-and-player-saving.patch | 2 +- .../1002-Improved-Watchdog-Support.patch | 4 +- .../1014-Execute-chunk-tasks-mid-tick.patch | 2 +- patches/server/1026-Optimize-Hoppers.patch | 2 +- .../server/1030-Lag-compensation-ticks.patch | 2 +- ...x-and-optimise-world-force-upgrading.patch | 2 +- 15 files changed, 91 insertions(+), 28 deletions(-) diff --git a/patches/server/0003-Build-system-changes.patch b/patches/server/0003-Build-system-changes.patch index 2e076b8a8..387087360 100644 --- a/patches/server/0003-Build-system-changes.patch +++ b/patches/server/0003-Build-system-changes.patch @@ -98,7 +98,7 @@ index 14fc03563daea531314c7ceba56dbb47884010ee..fcf95958ef659c7aa8e28026961fa1d6 } diff --git a/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java b/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java -index a5e8713bc0fefae455b666ebf13c9529e7ba94e6..407254c779c8291543873fe4e94c5f94981a81eb 100644 +index a5e8713bc0fefae455b666ebf13c9529e7ba94e6..def8ed40ef732b512a07fe50449c77a860b97462 100644 --- a/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java +++ b/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java @@ -48,7 +48,7 @@ public class ServerPacksSource extends BuiltInPackSource { @@ -110,6 +110,52 @@ index a5e8713bc0fefae455b666ebf13c9529e7ba94e6..407254c779c8291543873fe4e94c5f94 .applyDevelopmentConfig() .pushJarResources() .build(VANILLA_PACK_INFO); +@@ -68,7 +68,15 @@ public class ServerPacksSource extends BuiltInPackSource { + @Nullable + @Override + protected Pack createBuiltinPack(String fileName, Pack.ResourcesSupplier packFactory, Component displayName) { +- return Pack.readMetaAndCreate(createBuiltInPackLocation(fileName, displayName), packFactory, PackType.SERVER_DATA, FEATURE_SELECTION_CONFIG); ++ // Paper start - custom built-in pack ++ final PackLocationInfo info; ++ if ("paper".equals(fileName)) { ++ info = new PackLocationInfo(fileName, displayName, PackSource.BUILT_IN, Optional.empty()); ++ } else { ++ info = createBuiltInPackLocation(fileName, displayName); ++ } ++ return Pack.readMetaAndCreate(info, packFactory, PackType.SERVER_DATA, FEATURE_SELECTION_CONFIG); ++ // Paper end - custom built-in pack + } + + public static PackRepository createPackRepository(Path dataPacksPath, DirectoryValidator symlinkFinder) { +diff --git a/src/main/java/net/minecraft/world/level/DataPackConfig.java b/src/main/java/net/minecraft/world/level/DataPackConfig.java +index 3338a2423275ffff000a61d49167bb631bac3e32..72b5095b286009e95c7cbc0a579d3527d4b88866 100644 +--- a/src/main/java/net/minecraft/world/level/DataPackConfig.java ++++ b/src/main/java/net/minecraft/world/level/DataPackConfig.java +@@ -9,8 +9,8 @@ public class DataPackConfig { + public static final DataPackConfig DEFAULT = new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()); + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( +- Codec.STRING.listOf().fieldOf("Enabled").forGetter(settings -> settings.enabled), +- Codec.STRING.listOf().fieldOf("Disabled").forGetter(settings -> settings.disabled) ++ Codec.STRING.listOf().validate(DataPackConfig::ensureEnabled).fieldOf("Enabled").forGetter(settings -> settings.enabled), // Paper - ensure "paper" is always enabled ++ Codec.STRING.listOf().validate(DataPackConfig::ensureNotDisabled).fieldOf("Disabled").forGetter(settings -> settings.disabled) // Paper - ensure "paper" is always enabled + ) + .apply(instance, DataPackConfig::new) + ); +@@ -29,4 +29,13 @@ public class DataPackConfig { + public List getDisabled() { + return this.disabled; + } ++ // Paper start - ensure "paper" datapack is always enabled ++ private static com.mojang.serialization.DataResult> ensureEnabled(final List enabled) { ++ return com.mojang.serialization.DataResult.success(enabled.contains("paper") ? enabled: io.papermc.paper.util.MCUtil.copyListAndAdd(enabled, "paper")); ++ } ++ ++ private static com.mojang.serialization.DataResult> ensureNotDisabled(final List disabled) { ++ return com.mojang.serialization.DataResult.success(io.papermc.paper.util.MCUtil.copyListAndRemoveIf(disabled, "paper"::equals)); ++ } ++ // Paper end - ensure "paper" datapack is always enabled + } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java index 5595eb892fa868508c45448942da65d7c11d49fd..4b8602b168f9dd386aa72b4e5d189c441c93542e 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java @@ -139,6 +185,18 @@ index 93046379d0cefd5d3236fc59e698809acdc18f80..774556a62eb240da42e84db4502e2ed4 diff --git a/src/main/resources/data/.paperassetsroot b/src/main/resources/data/.paperassetsroot new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 +diff --git a/src/main/resources/data/minecraft/datapacks/paper/pack.mcmeta b/src/main/resources/data/minecraft/datapacks/paper/pack.mcmeta +new file mode 100644 +index 0000000000000000000000000000000000000000..288fbe68c6053f40e72f0feedef0ae0fed10fa67 +--- /dev/null ++++ b/src/main/resources/data/minecraft/datapacks/paper/pack.mcmeta +@@ -0,0 +1,6 @@ ++{ ++ "pack": { ++ "description": "Built-in Paper Datapack", ++ "pack_format": 41 ++ } ++} diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java index 1bdf0b2b8f8e6dace403695fece80ebb3dc9e039..544307fe34cbcfa286a7d7b30900ebea127d189e 100644 --- a/src/test/java/org/bukkit/support/AbstractTestingBase.java diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index 3a0102f6b..55b87b1e4 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -5638,11 +5638,11 @@ index 0000000000000000000000000000000000000000..28d777610b52ba74f808bf3245d73b83 +++ b/src/main/resources/META-INF/services/net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer$Provider @@ -0,0 +1 @@ +io.papermc.paper.adventure.providers.PlainTextComponentSerializerProviderImpl -diff --git a/src/main/resources/data/paper/chat_type/raw.json b/src/main/resources/data/paper/chat_type/raw.json +diff --git a/src/main/resources/data/minecraft/datapacks/paper/data/paper/chat_type/raw.json b/src/main/resources/data/minecraft/datapacks/paper/data/paper/chat_type/raw.json new file mode 100644 index 0000000000000000000000000000000000000000..3aedd0bbc97edacc1ebf71264b310e55aaaa5cb3 --- /dev/null -+++ b/src/main/resources/data/paper/chat_type/raw.json ++++ b/src/main/resources/data/minecraft/datapacks/paper/data/paper/chat_type/raw.json @@ -0,0 +1,14 @@ +{ + "chat": { diff --git a/patches/server/0694-Custom-Potion-Mixes.patch b/patches/server/0694-Custom-Potion-Mixes.patch index 75e13dc1c..763e3cf35 100644 --- a/patches/server/0694-Custom-Potion-Mixes.patch +++ b/patches/server/0694-Custom-Potion-Mixes.patch @@ -32,14 +32,23 @@ index 0000000000000000000000000000000000000000..7ea357ac2f3a93db4ebdf24b5072be7d + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index ea442883eda28e5673cef9470145d5c40ac66159..79f7e0fb2f1aa6af441c6e09d2c443d7d4bb47ef 100644 +index ea442883eda28e5673cef9470145d5c40ac66159..25ce1b9dbaa77e2c8541d995a2c28f894cee9d38 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -291,7 +291,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop public (remove final) + private volatile boolean isSaving; + + // CraftBukkit start @@ -2141,6 +2141,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop mix : this.containerMixes) { if (input.is(mix.from) && mix.ingredient.test(ingredient)) { return PotionContents.createItemStack(mix.to.value(), optional.get()); -@@ -190,6 +203,54 @@ public class PotionBrewing { +@@ -190,6 +203,50 @@ public class PotionBrewing { builder.addMix(Potions.SLOW_FALLING, Items.REDSTONE, Potions.LONG_SLOW_FALLING); } @@ -146,12 +155,8 @@ index 50e81e3babd331077eda8daa769eb2b3f99e8ca2..45b1a0346c7b0a541b336e2a89f825bf + return CUSTOM_MIXES.remove(key) != null; + } + -+ public void reload(FeatureFlagSet flags) { -+ potionMixes.clear(); -+ containerMixes.clear(); -+ containers.clear(); -+ CUSTOM_MIXES.clear(); -+ bootstrap(flags); ++ public PotionBrewing reload(FeatureFlagSet flags) { ++ return bootstrap(flags); + } + // Paper end - Custom Potion Mixes + @@ -220,7 +225,7 @@ index 139dff90561ac6c51954c6289918a07aeea13a1b..6ba29875d78ede4aa7978ff689e588f7 if (bukkit == null) { diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java new file mode 100644 -index 0000000000000000000000000000000000000000..5c08be880b81ce8627e7679942f273a948bed934 +index 0000000000000000000000000000000000000000..bb47c776cf1d92ef85a5a10d1c42f120457d21c1 --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java @@ -0,0 +1,66 @@ @@ -286,7 +291,7 @@ index 0000000000000000000000000000000000000000..5c08be880b81ce8627e7679942f273a9 + + @Override + public void resetPotionMixes() { -+ this.minecraftServer.potionBrewing().reload(this.minecraftServer.getWorldData().enabledFeatures()); ++ this.minecraftServer.potionBrewing = this.minecraftServer.potionBrewing().reload(this.minecraftServer.getWorldData().enabledFeatures()); + } + // Paper end +} diff --git a/patches/server/0732-Throw-exception-on-world-create-while-being-ticked.patch b/patches/server/0732-Throw-exception-on-world-create-while-being-ticked.patch index bcd3c3953..691b83c5a 100644 --- a/patches/server/0732-Throw-exception-on-world-create-while-being-ticked.patch +++ b/patches/server/0732-Throw-exception-on-world-create-while-being-ticked.patch @@ -7,7 +7,7 @@ There are no plans to support creating worlds while worlds are being ticked themselvess. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 79f7e0fb2f1aa6af441c6e09d2c443d7d4bb47ef..00457548d43e1d2143d1f6027593a1178f02564a 100644 +index 25ce1b9dbaa77e2c8541d995a2c28f894cee9d38..928798903a70a641626dd74faf2c2e628db28d0f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -314,6 +314,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop