diff options
author | Noah van der Aa <[email protected]> | 2021-12-01 02:31:13 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-11-30 17:31:13 -0800 |
commit | cd9fe9ca642322f8ba560a8c0f86c877af2cd10f (patch) | |
tree | 0099ebdd316d7b54e32fde7c5039011555b330ad /patches/server/0455-Improve-Legacy-Component-serialization-size.patch | |
parent | effa3bad36df91b9cca1920e357b963806f62ff6 (diff) | |
download | Paper-cd9fe9ca642322f8ba560a8c0f86c877af2cd10f.tar.gz Paper-cd9fe9ca642322f8ba560a8c0f86c877af2cd10f.zip |
Port flat bedrock (generator settings) to 1.18 (#6960)
Diffstat (limited to 'patches/server/0455-Improve-Legacy-Component-serialization-size.patch')
-rw-r--r-- | patches/server/0455-Improve-Legacy-Component-serialization-size.patch | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/patches/server/0455-Improve-Legacy-Component-serialization-size.patch b/patches/server/0455-Improve-Legacy-Component-serialization-size.patch deleted file mode 100644 index 8d30b49c6b..0000000000 --- a/patches/server/0455-Improve-Legacy-Component-serialization-size.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Sun, 28 Jun 2020 19:08:41 -0400 -Subject: [PATCH] Improve Legacy Component serialization size - -Don't constantly send format: false for all formatting options when parent already -has it false - -diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java -index 0de5a46423ae0403dcbfca630dfd7c5ac1e1761d..26d43c229caf9f8504af7071c3a61ec6da7e27ec 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java -@@ -46,6 +46,7 @@ public final class CraftChatMessage { - // Separate pattern with no group 3, new lines are part of previous string - private static final Pattern INCREMENTAL_PATTERN_KEEP_NEWLINES = Pattern.compile("(" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + "[0-9a-fk-orx])|((?:(?:https?):\\/\\/)?(?:[-\\w_\\.]{2,}\\.[a-z]{2,4}.*?(?=[\\.\\?!,;:]?(?:[" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + " ]|$))))", Pattern.CASE_INSENSITIVE); - // ChatColor.b does not explicitly reset, its more of empty -+ private static final Style EMPTY = Style.EMPTY.withItalic(false); // Paper - OBFHELPER - private static final Style RESET = Style.EMPTY.withBold(false).withItalic(false).withUnderlined(false).withStrikethrough(false).withObfuscated(false); - - private final List<Component> list = new ArrayList<Component>(); -@@ -67,6 +68,7 @@ public final class CraftChatMessage { - Matcher matcher = (keepNewlines ? StringMessage.INCREMENTAL_PATTERN_KEEP_NEWLINES : StringMessage.INCREMENTAL_PATTERN).matcher(message); - String match = null; - boolean needsAdd = false; -+ boolean hasReset = false; // Paper - while (matcher.find()) { - int groupId = 0; - while ((match = matcher.group(++groupId)) == null) { -@@ -112,7 +114,26 @@ public final class CraftChatMessage { - throw new AssertionError("Unexpected message format"); - } - } else { // Color resets formatting -- this.modifier = StringMessage.RESET.withColor(format); -+ // Paper start - improve legacy formatting -+ Style previous = modifier; -+ modifier = (!hasReset ? RESET : EMPTY).withColor(format); -+ hasReset = true; -+ if (previous.isBold()) { -+ modifier = modifier.withBold(false); -+ } -+ if (previous.isItalic()) { -+ modifier = modifier.withItalic(false); -+ } -+ if (previous.isObfuscated()) { -+ modifier = modifier.withObfuscated(false); -+ } -+ if (previous.isStrikethrough()) { -+ modifier = modifier.withStrikethrough(false); -+ } -+ if (previous.isUnderlined()) { -+ modifier = modifier.withUnderlined(false); -+ } -+ // Paper end - } - needsAdd = true; - break; |