928bcc8d3a
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 09943450 Update SnakeYAML version 5515734f SPIGOT-7162: Incorrect description for Entity#getVehicle javadoc 6f82b381 PR-788: Add getHand() to all relevant events CraftBukkit Changes: aaf484f6f SPIGOT-7163: CraftMerchantRecipe doesn't copy demand and specialPrice from BukkitMerchantRecipe 5329dd6fd PR-1107: Add getHand() to all relevant events 93061706e SPIGOT-7045: Ocelots never spawn with babies with spawn reason OCELOT_BABY
57 Zeilen
3.4 KiB
Diff
57 Zeilen
3.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
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 4fede2161792ba3e7cdf0cc5a1f533188becc6f7..0f70be614f8f5350ad558d0ae645cdf0027e1e76 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
|
@@ -47,6 +47,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>();
|
|
@@ -68,6 +69,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) {
|
|
@@ -113,7 +115,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;
|