From c946526ab12f214686afc359cb6eb90e72cbeb8e Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Thu, 9 Jun 2022 14:11:43 -0700 Subject: [PATCH] minimessage conversion --- ...ault-permission-message-configurable.patch | 16 ++- ...184-Expose-the-internal-current-tick.patch | 4 +- ...191-Expose-MinecraftServer-isRunning.patch | 4 +- patches/api/0201-Add-Mob-Goal-API.patch | 4 +- patches/api/0296-Add-basic-Datapack-API.patch | 4 +- patches/api/0371-Custom-Potion-Mixes.patch | 4 +- ...97-Broadcast-join-message-to-console.patch | 0 patches/server/0004-Paper-config-files.patch | 109 +++++++++++++++--- patches/server/0009-Paper-command.patch | 2 +- patches/server/0011-Paper-Metrics.patch | 4 +- ...-a-custom-authentication-servers-dow.patch | 12 +- ...e-PlayerProfile-in-AsyncPreLoginEven.patch | 4 +- .../0180-Player.setPlayerProfile-API.patch | 6 +- ...ble-connection-throttle-kick-message.patch | 4 +- ...3-Add-Velocity-IP-Forwarding-Support.patch | 6 +- ...ault-permission-message-configurable.patch | 9 +- ...324-Expose-the-internal-current-tick.patch | 4 +- patches/server/0353-Anti-Xray.patch | 6 +- ...-Add-tick-times-API-and-mspt-command.patch | 4 +- ...374-Expose-MinecraftServer-isRunning.patch | 4 +- .../server/0410-Implement-Mob-Goal-API.patch | 4 +- ...rs-not-working-in-some-kick-messages.patch | 13 +-- ...-address-to-AsyncPlayerPreLoginEvent.patch | 4 +- .../server/0640-Add-basic-Datapack-API.patch | 4 +- .../0745-Add-packet-limiter-config.patch | 6 +- ...Hostname-to-AsyncPlayerPreLoginEvent.patch | 4 +- patches/server/0854-Custom-Potion-Mixes.patch | 4 +- 27 files changed, 167 insertions(+), 82 deletions(-) rename patches/removed/1.19/{ => no-longer-needed}/0397-Broadcast-join-message-to-console.patch (100%) diff --git a/patches/api/0164-Make-the-default-permission-message-configurable.patch b/patches/api/0164-Make-the-default-permission-message-configurable.patch index 56059efd9..451ee36b9 100644 --- a/patches/api/0164-Make-the-default-permission-message-configurable.patch +++ b/patches/api/0164-Make-the-default-permission-message-configurable.patch @@ -25,19 +25,29 @@ index 653fe32bd134945e1cb1cf40f2623ffffdf5d762..9bd83fc81ae5a196a7254a4fd68f8848 * Creates a PlayerProfile for the specified uuid, with name as null. * diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 2042f4963c53d5a903f0de1fec6a9af3a7b2bba4..b8ed8d5d48cb4f1b2f598e2c48e4423ab2d899f4 100644 +index 2042f4963c53d5a903f0de1fec6a9af3a7b2bba4..475fe51ff7a9f1c1ed5048ea59d6d8ba73f2903c 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1854,6 +1854,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -1854,6 +1854,23 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi */ boolean suggestPlayerNamesWhenNullTabCompletions(); + /** ++ * Gets the default no permission message used on the server + * -+ * @return the default no permission message used on the server ++ * @return the default message ++ * @deprecated use {@link #permissionMessage()} + */ + @NotNull ++ @Deprecated + String getPermissionMessage(); ++ ++ /** ++ * Gets the default no permission message used on the server ++ * ++ * @return the default message ++ */ ++ @NotNull net.kyori.adventure.text.Component permissionMessage(); + /** * Creates a PlayerProfile for the specified uuid, with name as null. diff --git a/patches/api/0184-Expose-the-internal-current-tick.patch b/patches/api/0184-Expose-the-internal-current-tick.patch index 2421f661d..420a314b5 100644 --- a/patches/api/0184-Expose-the-internal-current-tick.patch +++ b/patches/api/0184-Expose-the-internal-current-tick.patch @@ -20,10 +20,10 @@ index 3a011b6fe654da9710aa81c4e13e9b135fbecfc3..5880fe78b52cab2e9c2e4f2639570e03 @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 102ce4e488d5b6fd4a19766e9fa02d29075b2c33..ad1d73940908f4f20a4944e81b186739fded20ab 100644 +index 911b26247b3cd5e80c1f0a904ad3f88761091551..97149dc0142bd910681b8f013803fb3ea9f72dbb 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1927,5 +1927,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -1937,5 +1937,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi */ @NotNull com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name); diff --git a/patches/api/0191-Expose-MinecraftServer-isRunning.patch b/patches/api/0191-Expose-MinecraftServer-isRunning.patch index 6bb47f187..7ebb6da13 100644 --- a/patches/api/0191-Expose-MinecraftServer-isRunning.patch +++ b/patches/api/0191-Expose-MinecraftServer-isRunning.patch @@ -26,10 +26,10 @@ index 3b60fa65686572fdd8fab22cd131ca5cfe5274c8..3455de478517a91285bb9d1b306ce1c4 @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 6fe653a2a0fd4f07d39ed584bc11688d4926d54e..d59a7e0c9ec50040fb0b2cc3239cae46760aba04 100644 +index b549cb954e4fb4e37277303911d174bedd0ee27d..8895de971276bc8027c9f02dee41f002dfcb8770 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1949,5 +1949,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -1959,5 +1959,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi * @return Current tick */ int getCurrentTick(); diff --git a/patches/api/0201-Add-Mob-Goal-API.patch b/patches/api/0201-Add-Mob-Goal-API.patch index d544a7f86..6a7d15f54 100644 --- a/patches/api/0201-Add-Mob-Goal-API.patch +++ b/patches/api/0201-Add-Mob-Goal-API.patch @@ -544,10 +544,10 @@ index 706e42172b938840c6ec06f0f7b686eee17a4a93..3faefc48a2dca51f19d4289547f0ce87 @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 9b2c1eb7e215a9227c60bc85906fed33ec1dd60a..c11d802408c793c6410118bd281a21e59394066f 100644 +index 81b6368189809808d2d42a21a5437b7b215f2ee2..aa621e00d48aafcbc6f9baeff55082248ad487f1 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1966,5 +1966,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -1976,5 +1976,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi * @return true if server is in the process of being shutdown */ boolean isStopping(); diff --git a/patches/api/0296-Add-basic-Datapack-API.patch b/patches/api/0296-Add-basic-Datapack-API.patch index fd30969d7..4b85aa9dc 100644 --- a/patches/api/0296-Add-basic-Datapack-API.patch +++ b/patches/api/0296-Add-basic-Datapack-API.patch @@ -89,10 +89,10 @@ index 4c6780dd1375f5d2c6e60229cc05c4af9d480b8a..3e3e48f467eef561eeada98c6b99388e @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 181493def187f72b6ff89c3849598428f35d31f3..2409c0023f90689399c8ceba179b800156d16eea 100644 +index c22fdde77b3d1b00577f45027dd5799bbb1cd3a3..09d72432cd854b929b262112921370138344e39c 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -2013,5 +2013,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -2023,5 +2023,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi */ @NotNull com.destroystokyo.paper.entity.ai.MobGoals getMobGoals(); diff --git a/patches/api/0371-Custom-Potion-Mixes.patch b/patches/api/0371-Custom-Potion-Mixes.patch index e0f50d867..b922434e3 100644 --- a/patches/api/0371-Custom-Potion-Mixes.patch +++ b/patches/api/0371-Custom-Potion-Mixes.patch @@ -122,10 +122,10 @@ index 7fcb2d84e707576531ddb9a7dd85cf0481ae58ce..a87399fa4838d4b2c1ff9cc35d433ae7 @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 5aa14f6c2f5be4d72689d764ad4d0ce5a3d704a8..79b26045a68ebb9b01e5bd06abbccaaef5489777 100644 +index 99821da965069d54820bbbe349ab5dc09226f450..30b49aed62fa67276e8964922ea3f84458d854bb 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -2047,5 +2047,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -2057,5 +2057,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi */ @NotNull io.papermc.paper.datapack.DatapackManager getDatapackManager(); diff --git a/patches/removed/1.19/0397-Broadcast-join-message-to-console.patch b/patches/removed/1.19/no-longer-needed/0397-Broadcast-join-message-to-console.patch similarity index 100% rename from patches/removed/1.19/0397-Broadcast-join-message-to-console.patch rename to patches/removed/1.19/no-longer-needed/0397-Broadcast-join-message-to-console.patch diff --git a/patches/server/0004-Paper-config-files.patch b/patches/server/0004-Paper-config-files.patch index a23862a5d..6cdfb64d0 100644 --- a/patches/server/0004-Paper-config-files.patch +++ b/patches/server/0004-Paper-config-files.patch @@ -404,17 +404,18 @@ index 0000000000000000000000000000000000000000..844275e8671c62633e370ae3d4e0738e +} diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java new file mode 100644 -index 0000000000000000000000000000000000000000..30633591ecd078997e7bb0dc937f8c5ddedaa3ab +index 0000000000000000000000000000000000000000..5a808a09291da691cbee75a55f6aa1b70ac9f018 --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -@@ -0,0 +1,263 @@ +@@ -0,0 +1,264 @@ +package io.papermc.paper.configuration; + +import co.aikar.timings.MinecraftTimings; -+import co.aikar.timings.TimingsManager; +import com.destroystokyo.paper.io.chunk.ChunkTaskManager; +import io.papermc.paper.configuration.constraint.Constraint; +import io.papermc.paper.configuration.constraint.Constraints; ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.format.NamedTextColor; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ServerboundPlaceRecipePacket; +import org.checkerframework.checker.nullness.qual.Nullable; @@ -447,13 +448,13 @@ index 0000000000000000000000000000000000000000..30633591ecd078997e7bb0dc937f8c5d + public Kick kick; + + public class Kick extends ConfigurationPart { -+ public String authenticationServersDown = ""; // TODO empty is fallback to translatable msg -+ public String connectionThrottle = "Connection throttled! Please wait before reconnecting."; -+ public String flyingPlayer = "Flying is not enabled on this server"; -+ public String flyingVehicle = "Flying is not enabled on this server"; ++ public Component authenticationServersDown = Component.translatable("multiplayer.disconnect.authservers_down"); ++ public Component connectionThrottle = Component.text("Connection throttled! Please wait before reconnecting."); ++ public Component flyingPlayer = Component.translatable("multiplayer.disconnect.flying"); ++ public Component flyingVehicle = Component.translatable("multiplayer.disconnect.flying"); + } + -+ public String noPermission = "&cI'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error."; ++ public Component noPermission = Component.text("I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error.", NamedTextColor.RED); + public boolean useDisplayNameInQuitMessage = false; + } + @@ -613,7 +614,7 @@ index 0000000000000000000000000000000000000000..30633591ecd078997e7bb0dc937f8c5d + public PacketLimiter packetLimiter; + + public class PacketLimiter extends ConfigurationPart { -+ public String kickMessage = "&cSent too many packets"; // todo: minimessage ++ public Component kickMessage = Component.translatable("disconnect.exceeded_packet_rate", NamedTextColor.RED); + public PacketLimit allPackets = new PacketLimit(7.0, 500.0, PacketLimit.ViolateAction.KICK); + public Map>, PacketLimit> overrides = Map.of(ServerboundPlaceRecipePacket.class, new PacketLimit(4.0, 5.0, PacketLimit.ViolateAction.DROP)); + @@ -835,10 +836,10 @@ index 0000000000000000000000000000000000000000..69add4a7f1147015806bc9b63a8340d1 +} diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java new file mode 100644 -index 0000000000000000000000000000000000000000..d25393aa10a02a74f500c520bfb2979428693177 +index 0000000000000000000000000000000000000000..214bc66788d1736d40202b794ab5f820e0ebe611 --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -@@ -0,0 +1,392 @@ +@@ -0,0 +1,394 @@ +package io.papermc.paper.configuration; + +import com.google.common.base.Suppliers; @@ -846,6 +847,7 @@ index 0000000000000000000000000000000000000000..d25393aa10a02a74f500c520bfb29794 +import com.mojang.logging.LogUtils; +import io.leangen.geantyref.TypeToken; +import io.papermc.paper.configuration.legacy.RequiresSpigotInitialization; ++import io.papermc.paper.configuration.serializer.ComponentSerializer; +import io.papermc.paper.configuration.serializer.EnumValueSerializer; +import io.papermc.paper.configuration.serializer.FastutilMapSerializer; +import io.papermc.paper.configuration.serializer.PacketClassSerializer; @@ -971,6 +973,7 @@ index 0000000000000000000000000000000000000000..d25393aa10a02a74f500c520bfb29794 + return options.serializers(builder -> builder + .register(MapSerializer.TYPE, new MapSerializer(false)) + .register(new EnumValueSerializer()) ++ .register(new ComponentSerializer()) + ); + } + @@ -2006,6 +2009,38 @@ index 0000000000000000000000000000000000000000..4e3bcd7c478096384fcc643d48771ab9 +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.framework.qual.DefaultQualifier; \ No newline at end of file +diff --git a/src/main/java/io/papermc/paper/configuration/serializer/ComponentSerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/ComponentSerializer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..9c339ef178ebc3b0251095f320e4a7a3656d3521 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/serializer/ComponentSerializer.java +@@ -0,0 +1,26 @@ ++package io.papermc.paper.configuration.serializer; ++ ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.minimessage.MiniMessage; ++import org.spongepowered.configurate.serialize.ScalarSerializer; ++import org.spongepowered.configurate.serialize.SerializationException; ++ ++import java.lang.reflect.Type; ++import java.util.function.Predicate; ++ ++public class ComponentSerializer extends ScalarSerializer { ++ ++ public ComponentSerializer() { ++ super(Component.class); ++ } ++ ++ @Override ++ public Component deserialize(Type type, Object obj) throws SerializationException { ++ return MiniMessage.miniMessage().deserialize(obj.toString()); ++ } ++ ++ @Override ++ protected Object serialize(Component component, Predicate> typeSupported) { ++ return MiniMessage.miniMessage().serialize(component); ++ } ++} diff --git a/src/main/java/io/papermc/paper/configuration/serializer/EnumValueSerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/EnumValueSerializer.java new file mode 100644 index 0000000000000000000000000000000000000000..2afb9268447792e3cdb46172b2050dbce066c59a @@ -2693,18 +2728,23 @@ index 0000000000000000000000000000000000000000..0300fb1e09d41465e4a50bfdc987b957 +} diff --git a/src/main/java/io/papermc/paper/configuration/transformation/global/LegacyPaperConfig.java b/src/main/java/io/papermc/paper/configuration/transformation/global/LegacyPaperConfig.java new file mode 100644 -index 0000000000000000000000000000000000000000..9866cffcec3fdff4f9abc616d4374591d8d13860 +index 0000000000000000000000000000000000000000..55886e548d3b140c4fb14495f7265ea3e1c26fd0 --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/transformation/global/LegacyPaperConfig.java -@@ -0,0 +1,190 @@ +@@ -0,0 +1,236 @@ +package io.papermc.paper.configuration.transformation.global; + +import com.mojang.logging.LogUtils; +import io.papermc.paper.configuration.Configuration; +import io.papermc.paper.configuration.serializer.PacketClassSerializer; +import io.papermc.paper.util.ObfHelper; ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.format.NamedTextColor; ++import net.kyori.adventure.text.minimessage.MiniMessage; ++import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ServerboundPlaceRecipePacket; ++import org.bukkit.ChatColor; +import org.bukkit.configuration.file.YamlConfiguration; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.slf4j.Logger; @@ -2713,6 +2753,8 @@ index 0000000000000000000000000000000000000000..9866cffcec3fdff4f9abc616d4374591 +import org.spongepowered.configurate.transformation.ConfigurationTransformation; +import org.spongepowered.configurate.transformation.TransformAction; + ++import java.util.function.Predicate; ++ +import static org.spongepowered.configurate.NodePath.path; + +public final class LegacyPaperConfig { @@ -2867,10 +2909,49 @@ index 0000000000000000000000000000000000000000..9866cffcec3fdff4f9abc616d4374591 + + moveFromRoot(builder, "proxy-protocol", "proxies"); + ++ miniMessageWithTranslatable(builder, String::isBlank, "multiplayer.disconnect.authservers_down", "messages", "kick", "authentication-servers-down"); ++ miniMessageWithTranslatable(builder, Predicate.isEqual("Flying is not enabled on this server"), "multiplayer.disconnect.flying", "messages", "kick", "flying-player"); ++ miniMessageWithTranslatable(builder, Predicate.isEqual("Flying is not enabled on this server"), "multiplayer.disconnect.flying", "messages", "kick", "flying-vehicle"); ++ miniMessage(builder, "messages", "kick", "connection-throttle"); ++ miniMessage(builder, "messages", "no-permission"); ++ miniMessageWithTranslatable(builder, Predicate.isEqual("&cSent too many packets"), Component.translatable("disconnect.exceeded_packet_rate", NamedTextColor.RED), "packet-limiter", "kick-message"); ++ + return builder.build(); + } + -+ private static void moveFromRootToMisc(final ConfigurationTransformation.Builder builder, String key) { ++ private static void miniMessageWithTranslatable(final ConfigurationTransformation.Builder builder, final Predicate englishCheck, final String i18nKey, final String... strPath) { ++ miniMessageWithTranslatable(builder, englishCheck, Component.translatable(i18nKey), strPath); ++ } ++ private static void miniMessageWithTranslatable(final ConfigurationTransformation.Builder builder, final Predicate englishCheck, final Component component, final String... strPath) { ++ builder.addAction(path((Object[]) strPath), (path, value) -> { ++ final @Nullable Object val = value.raw(); ++ if (val != null) { ++ final String strVal = val.toString(); ++ if (!englishCheck.test(strVal)) { ++ value.set(miniMessage(strVal)); ++ return null; ++ } ++ } ++ value.set(MiniMessage.miniMessage().serialize(component)); ++ return null; ++ }); ++ } ++ ++ private static void miniMessage(final ConfigurationTransformation.Builder builder, final String... strPath) { ++ builder.addAction(path((Object[]) strPath), (path, value) -> { ++ final @Nullable Object val = value.raw(); ++ if (val != null) { ++ value.set(miniMessage(val.toString())); ++ } ++ return null; ++ }); ++ } ++ ++ private static String miniMessage(final String input) { ++ return MiniMessage.miniMessage().serialize(LegacyComponentSerializer.legacySection().deserialize(ChatColor.translateAlternateColorCodes('&', input))); ++ } ++ ++ private static void moveFromRootToMisc(final ConfigurationTransformation.Builder builder, final String key) { + moveFromRoot(builder, key, "misc"); + } + diff --git a/patches/server/0009-Paper-command.patch b/patches/server/0009-Paper-command.patch index a1dd2d7de..149c8c3c8 100644 --- a/patches/server/0009-Paper-command.patch +++ b/patches/server/0009-Paper-command.patch @@ -307,7 +307,7 @@ index d25393aa10a02a74f500c520bfb2979428693177..2e8da92c09fca465b754e45e0bf9984b import com.google.common.base.Suppliers; import com.google.common.collect.Table; import com.mojang.logging.LogUtils; -@@ -350,6 +351,7 @@ public class PaperConfigurations extends Configurations COMMANDS = new HashMap<>(); static { diff --git a/patches/server/0011-Paper-Metrics.patch b/patches/server/0011-Paper-Metrics.patch index 98cdc3148..4b187e8b5 100644 --- a/patches/server/0011-Paper-Metrics.patch +++ b/patches/server/0011-Paper-Metrics.patch @@ -700,7 +700,7 @@ index 2e8da92c09fca465b754e45e0bf9984b978557e9..b1845b20091b2a28a988f729c18415bb import com.destroystokyo.paper.PaperCommand; import com.google.common.base.Suppliers; import com.google.common.collect.Table; -@@ -350,6 +351,7 @@ public class PaperConfigurations extends Configurations COMMANDS = new HashMap<>(); @@ -708,7 +708,7 @@ index 2e8da92c09fca465b754e45e0bf9984b978557e9..b1845b20091b2a28a988f729c18415bb static { COMMANDS.put("paper", new PaperCommand("paper")); } -@@ -358,6 +360,11 @@ public class PaperConfigurations extends Configurations { server.server.getCommandMap().register(s, "Paper", command); }); diff --git a/patches/server/0152-Allow-specifying-a-custom-authentication-servers-dow.patch b/patches/server/0152-Allow-specifying-a-custom-authentication-servers-dow.patch index fa71afd81..720b3fddb 100644 --- a/patches/server/0152-Allow-specifying-a-custom-authentication-servers-dow.patch +++ b/patches/server/0152-Allow-specifying-a-custom-authentication-servers-dow.patch @@ -6,17 +6,15 @@ Subject: [PATCH] Allow specifying a custom "authentication servers down" kick diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index dc932515bada7f84a386827f3b7e1e8f69bd7159..9fe3ec7e6bd194b825a1b29bcff9fcd5e21f22ad 100644 +index dc932515bada7f84a386827f3b7e1e8f69bd7159..d2f0450c6bae722bfa9162b027e723eb10b22c78 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -358,6 +358,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -358,7 +358,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener ServerLoginPacketListenerImpl.this.gameProfile = ServerLoginPacketListenerImpl.this.createFakeProfile(gameprofile); ServerLoginPacketListenerImpl.this.state = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT; } else { -+ // Paper start -+ if (!io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.authenticationServersDown.isEmpty()) { -+ ServerLoginPacketListenerImpl.this.disconnect(Component.literal(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.authenticationServersDown)); -+ } else // Paper end - ServerLoginPacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.authservers_down")); +- ServerLoginPacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.authservers_down")); ++ ServerLoginPacketListenerImpl.this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.authenticationServersDown)); // Paper ServerLoginPacketListenerImpl.LOGGER.error("Couldn't verify username because servers are unavailable"); } + // CraftBukkit start - catch all exceptions diff --git a/patches/server/0179-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch b/patches/server/0179-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch index 0827a4224..96cfdac92 100644 --- a/patches/server/0179-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch +++ b/patches/server/0179-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent This will allow you to change the players name or skin on login. diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 5bf48f4fb0794a1eaea3783add9e5852997434f6..27a90187a615734fb86d0325dae0c7af2768375a 100644 +index 145f3eae6622453d47769e10fb30ce8d31d5f847..53e8804b8ee35acdc2c4b3cbe2bc409242840726 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -397,8 +397,16 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -393,8 +393,16 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId(); final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server; diff --git a/patches/server/0180-Player.setPlayerProfile-API.patch b/patches/server/0180-Player.setPlayerProfile-API.patch index 6895da16b..f1bb7536d 100644 --- a/patches/server/0180-Player.setPlayerProfile-API.patch +++ b/patches/server/0180-Player.setPlayerProfile-API.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Player.setPlayerProfile API This can be useful for changing name or skins after a player has logged in. diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 27a90187a615734fb86d0325dae0c7af2768375a..e27ce986dab7b249f8a69e1d94cfbd91bab5c4b9 100644 +index 53e8804b8ee35acdc2c4b3cbe2bc409242840726..1b075033f0640433341957f6e26ebe25f18928ee 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -398,11 +398,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -394,11 +394,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server; // Paper start @@ -24,7 +24,7 @@ index 27a90187a615734fb86d0325dae0c7af2768375a..e27ce986dab7b249f8a69e1d94cfbd91 playerName = gameProfile.getName(); uniqueId = gameProfile.getId(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e6ca45329c5f102ebf4abc729837108cad63a59f..380bdc7cfa8980d5db29a15b29613fc62d75de2a 100644 +index 153b5602f1c5f6ef7a184fc8c9cb72523fa3fccb..fd3304d1e58f0976cd048d4a265181a0f1251c2f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -75,6 +75,7 @@ import net.minecraft.world.entity.ai.attributes.Attributes; diff --git a/patches/server/0265-Configurable-connection-throttle-kick-message.patch b/patches/server/0265-Configurable-connection-throttle-kick-message.patch index 29956aa4b..388accb3a 100644 --- a/patches/server/0265-Configurable-connection-throttle-kick-message.patch +++ b/patches/server/0265-Configurable-connection-throttle-kick-message.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable connection throttle kick message diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -index 4170bda451df3db43e7d57d87d1abb81934d7dad..14fa831c9984e72ae2185c4f9e07f65b0c2ed67c 100644 +index 4170bda451df3db43e7d57d87d1abb81934d7dad..43759cdf3da0796d7969c6504ac9a6986c0f0518 100644 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java @@ -49,7 +49,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL @@ -13,7 +13,7 @@ index 4170bda451df3db43e7d57d87d1abb81934d7dad..14fa831c9984e72ae2185c4f9e07f65b if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.get(address) < connectionThrottle) { ServerHandshakePacketListenerImpl.throttleTracker.put(address, currentTime); - MutableComponent chatmessage = Component.literal("Connection throttled! Please wait before reconnecting."); -+ MutableComponent chatmessage = Component.literal(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.connectionThrottle); // Paper - Configurable connection throttle kick message ++ Component chatmessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.connectionThrottle); // Paper - Configurable connection throttle kick message this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage)); this.connection.disconnect(chatmessage); return; diff --git a/patches/server/0273-Add-Velocity-IP-Forwarding-Support.patch b/patches/server/0273-Add-Velocity-IP-Forwarding-Support.patch index 476ebdc26..e0567f56e 100644 --- a/patches/server/0273-Add-Velocity-IP-Forwarding-Support.patch +++ b/patches/server/0273-Add-Velocity-IP-Forwarding-Support.patch @@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..74b3265bba78491f462c15709a31bc44 + } +} diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index e27ce986dab7b249f8a69e1d94cfbd91bab5c4b9..1e4c306569fa96327dc99bb5dd6b3a749e60813e 100644 +index 1b075033f0640433341957f6e26ebe25f18928ee..b070624c7ee85b6692f1f44ded6c78139925b669 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -69,6 +69,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener @@ -112,7 +112,7 @@ index e27ce986dab7b249f8a69e1d94cfbd91bab5c4b9..1e4c306569fa96327dc99bb5dd6b3a74 // Spigot start // Paper start - Cache authenticator threads authenticatorPool.execute(new Runnable() { -@@ -392,6 +401,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -388,6 +397,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener public class LoginHandler { public void fireEvents() throws Exception { @@ -125,7 +125,7 @@ index e27ce986dab7b249f8a69e1d94cfbd91bab5c4b9..1e4c306569fa96327dc99bb5dd6b3a74 String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName(); java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(); java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId(); -@@ -439,6 +454,40 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -435,6 +450,40 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener // Spigot end public void handleCustomQueryPacket(ServerboundCustomQueryPacket packet) { diff --git a/patches/server/0285-Make-the-default-permission-message-configurable.patch b/patches/server/0285-Make-the-default-permission-message-configurable.patch index 7f62383e9..554a82f90 100644 --- a/patches/server/0285-Make-the-default-permission-message-configurable.patch +++ b/patches/server/0285-Make-the-default-permission-message-configurable.patch @@ -18,15 +18,20 @@ index e75134a6aa92c86aa86430c7603e111280077d16..c5b005e7a803c848dca31dc76d1ec83f } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9a9b6ceab49e78a6b5523825e571186f6f610212..fe5a676abb5c47045f6ca1a6dde78d9859b43abe 100644 +index 9a9b6ceab49e78a6b5523825e571186f6f610212..80e508aa9fc9cf41ecfc528086cc9eebde7b5728 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2586,6 +2586,11 @@ public final class CraftServer implements Server { +@@ -2586,6 +2586,16 @@ public final class CraftServer implements Server { return io.papermc.paper.configuration.GlobalConfiguration.get().commands.suggestPlayerNamesWhenNullTabCompletions; } + @Override + public String getPermissionMessage() { ++ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacyAmpersand().serialize(io.papermc.paper.configuration.GlobalConfiguration.get().messages.noPermission); ++ } ++ ++ @Override ++ public net.kyori.adventure.text.Component permissionMessage() { + return io.papermc.paper.configuration.GlobalConfiguration.get().messages.noPermission; + } + diff --git a/patches/server/0324-Expose-the-internal-current-tick.patch b/patches/server/0324-Expose-the-internal-current-tick.patch index 60ebe8afd..f0b9f6198 100644 --- a/patches/server/0324-Expose-the-internal-current-tick.patch +++ b/patches/server/0324-Expose-the-internal-current-tick.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose the internal current tick diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 403f4166b9e27a9037920195996e7f13c2fb31a2..4c8ca8625860c7a19c73da633b236e2b255bd6de 100644 +index b554f7f3ae57a2cca69a10ec3e8314180cf73d32..45d923dafdc7dad8b35b8bfd97ce7934abf7efde 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2622,5 +2622,10 @@ public final class CraftServer implements Server { +@@ -2627,5 +2627,10 @@ public final class CraftServer implements Server { profile.getProperties().putAll(((CraftPlayer)player).getHandle().getGameProfile().getProperties()); return new com.destroystokyo.paper.profile.CraftPlayerProfile(profile); } diff --git a/patches/server/0353-Anti-Xray.patch b/patches/server/0353-Anti-Xray.patch index 3512efc9d..6b8e0ae5b 100644 --- a/patches/server/0353-Anti-Xray.patch +++ b/patches/server/0353-Anti-Xray.patch @@ -1017,7 +1017,7 @@ index 0000000000000000000000000000000000000000..80a2dfb266ae1221680a7b24fee2f7e2 + } +} diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -index ab145a47bef1d356e28c719e5c25552ff4bc6555..e4845a818b3a9dc3b06a67b3a461ce506bb37cba 100644 +index bc0922d959816c990b16233689192b46371a73e4..5626a772908f7956a30a82ca73929b05c19f7268 100644 --- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java @@ -2,6 +2,7 @@ package io.papermc.paper.configuration; @@ -1028,7 +1028,7 @@ index ab145a47bef1d356e28c719e5c25552ff4bc6555..e4845a818b3a9dc3b06a67b3a461ce50 import com.google.common.base.Suppliers; import com.google.common.collect.Table; import com.mojang.logging.LogUtils; -@@ -191,6 +192,7 @@ public class PaperConfigurations extends Configurations> { @@ -40,8 +40,8 @@ index 05a15b2da76a6d246b705e682b61a7c40c5dade7..f13c93764d6026b7e53123a8f6f123d9 + + private boolean stopReadingPackets; + private void killForPacketSpam() { -+ this.sendPacket(new ClientboundDisconnectPacket(org.bukkit.craftbukkit.util.CraftChatMessage.fromString(io.papermc.paper.configuration.GlobalConfiguration.get().packetLimiter.kickMessage, true)[0]), (future) -> { -+ this.disconnect(org.bukkit.craftbukkit.util.CraftChatMessage.fromString(io.papermc.paper.configuration.GlobalConfiguration.get().packetLimiter.kickMessage, true)[0]); ++ this.sendPacket(new ClientboundDisconnectPacket(io.papermc.paper.adventure.PaperAdventure.asVanilla(io.papermc.paper.configuration.GlobalConfiguration.get().packetLimiter.kickMessage)), (future) -> { ++ this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(io.papermc.paper.configuration.GlobalConfiguration.get().packetLimiter.kickMessage)); + }); + this.setReadOnly(); + this.stopReadingPackets = true; diff --git a/patches/server/0831-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch b/patches/server/0831-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch index df4a1e9af..bfa71584c 100644 --- a/patches/server/0831-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch +++ b/patches/server/0831-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Added getHostname to AsyncPlayerPreLoginEvent diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index e581656c4450be708f1a91a42b5b1da9105df6f3..5f46bdcb109ec4af7e1241a278737b3dc41299f5 100644 +index f18c24266eecdc3d108c6523da6b75985bba291a..89f8690848db712f382d1a1e5b75053262d991ac 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -454,7 +454,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -450,7 +450,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener // Paper start com.destroystokyo.paper.profile.PlayerProfile profile = com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(ServerLoginPacketListenerImpl.this.gameProfile); diff --git a/patches/server/0854-Custom-Potion-Mixes.patch b/patches/server/0854-Custom-Potion-Mixes.patch index 169726607..ad7d13940 100644 --- a/patches/server/0854-Custom-Potion-Mixes.patch +++ b/patches/server/0854-Custom-Potion-Mixes.patch @@ -164,7 +164,7 @@ index 3d688e334c7287f41460bd866bfd1155e8bb55d2..55006724ccec9f3de828ec18693728e9 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c62af511153b104ae3fdf45c899cec5de5c0de53..bf45b635cb5397dc30ac9cf2d7c37fa1cfc1b32b 100644 +index 8d94fd23b85bf6bbe8486f3548dfd12360926f5d..781bc5ee94bdd33bfd31c3234c5a75132be5468a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -279,6 +279,7 @@ public final class CraftServer implements Server { @@ -184,7 +184,7 @@ index c62af511153b104ae3fdf45c899cec5de5c0de53..bf45b635cb5397dc30ac9cf2d7c37fa1 MobEffects.BLINDNESS.getClass(); PotionEffectType.stopAcceptingRegistrations(); // Ugly hack :( -@@ -2855,5 +2856,10 @@ public final class CraftServer implements Server { +@@ -2860,5 +2861,10 @@ public final class CraftServer implements Server { return datapackManager; }