diff --git a/patches/server/0054-Fix-legacy-colors-in-console.patch b/patches/server/0054-Fix-legacy-colors-in-console.patch new file mode 100644 index 0000000..64be92a --- /dev/null +++ b/patches/server/0054-Fix-legacy-colors-in-console.patch @@ -0,0 +1,119 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MartijnMuijsers +Date: Tue, 29 Nov 2022 21:03:47 +0100 +Subject: [PATCH] Fix legacy colors in console + +License: MIT (https://opensource.org/licenses/MIT) + +This patch is based on the following patch: +"Fix legacy colors in console" +By: BillyGalbreath +As part of: Purpur (https://github.com/PurpurMC/Purpur) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +diff --git a/src/main/java/io/papermc/paper/console/HexFormattingConverter.java b/src/main/java/io/papermc/paper/console/HexFormattingConverter.java +index b4d0b7ecd56ab952319946854168c1299cb0b1be..beea5c17f07f85825ed1ba5a016f6edc93112115 100644 +--- a/src/main/java/io/papermc/paper/console/HexFormattingConverter.java ++++ b/src/main/java/io/papermc/paper/console/HexFormattingConverter.java +@@ -17,6 +17,7 @@ import org.apache.logging.log4j.core.pattern.PatternFormatter; + import org.apache.logging.log4j.core.pattern.PatternParser; + import org.apache.logging.log4j.util.PerformanceSensitive; + import org.apache.logging.log4j.util.PropertiesUtil; ++import org.galemc.gale.configuration.GaleGlobalConfiguration; + + import java.util.List; + import java.util.regex.Matcher; +@@ -38,6 +39,7 @@ public final class HexFormattingConverter extends LogEventPatternConverter { + private static final String ANSI_RESET = "\u001B[m"; + + private static final char COLOR_CHAR = 0x7f; ++ private static final char LEGACY_CHAR = 0xa7; // Gale - Purpur - fix legacy colors in console + public static final LegacyComponentSerializer SERIALIZER = LegacyComponentSerializer.builder() + .hexColors() + .flattener(PaperAdventure.FLATTENER) +@@ -48,6 +50,10 @@ public final class HexFormattingConverter extends LogEventPatternConverter { + private static final String RGB_ANSI = "\u001B[38;2;%d;%d;%dm"; + private static final Pattern NAMED_PATTERN = Pattern.compile(COLOR_CHAR + "[0-9a-fk-orA-FK-OR]"); + private static final Pattern RGB_PATTERN = Pattern.compile(COLOR_CHAR + "#([0-9a-fA-F]){6}"); ++ // Gale start - Purpur - fix legacy colors in console ++ private static final Pattern LEGACY_RGB_PATTERN = Pattern.compile(LEGACY_CHAR + "x((" + LEGACY_CHAR + "[0-9a-fA-F]){6})"); ++ private static final Pattern LEGACY_PATTERN = Pattern.compile(LEGACY_CHAR + "([0-9a-fk-orxA-FK-ORX])"); ++ // Gale end - Purpur - fix legacy colors in console + + private static final String[] RGB_ANSI_CODES = new String[]{ + formatHexAnsi(NamedTextColor.BLACK), // Black ยง0 +@@ -133,7 +139,27 @@ public final class HexFormattingConverter extends LogEventPatternConverter { + } + + private static String convertRGBColors(final String input) { +- return RGB_PATTERN.matcher(input).replaceAll(result -> { ++ // Gale start - Purpur - fix legacy colors in console - lets just shove this back in place ++ String toConvert; ++ if (fixLegacyColors()) { ++ Matcher matcher = LEGACY_RGB_PATTERN.matcher(input); ++ StringBuilder buffer = new StringBuilder(); ++ while (matcher.find()) { ++ String s = matcher.group().replace(String.valueOf(LEGACY_CHAR), "").replace('x', '#'); ++ int hex = Integer.decode(s); ++ int red = (hex >> 16) & 0xFF; ++ int green = (hex >> 8) & 0xFF; ++ int blue = hex & 0xFF; ++ String replacement = String.format(RGB_ANSI, red, green, blue); ++ matcher.appendReplacement(buffer, replacement); ++ } ++ matcher.appendTail(buffer); ++ toConvert = buffer.toString(); ++ } else { ++ toConvert = input; ++ } ++ return RGB_PATTERN.matcher(toConvert).replaceAll(result -> { ++ // Gale end - Purpur - fix legacy colors in console - lets just shove this back in place + final int hex = Integer.decode(result.group().substring(1)); + return formatHexAnsi(hex); + }); +@@ -151,10 +177,18 @@ public final class HexFormattingConverter extends LogEventPatternConverter { + } + + private static String stripRGBColors(final String input) { +- return RGB_PATTERN.matcher(input).replaceAll(""); ++ // Gale start - Purpur - fix legacy colors in console ++ String removedRGB = RGB_PATTERN.matcher(input).replaceAll(""); ++ return fixLegacyColors() ? LEGACY_RGB_PATTERN.matcher(removedRGB).replaceAll("") : removedRGB; ++ // Gale end - Purpur - fix legacy colors in console + } + + static void format(String content, StringBuilder result, int start, boolean ansi) { ++ // Gale start - Purpur - fix legacy colors in console ++ if (fixLegacyColors()) { ++ content = LEGACY_PATTERN.matcher(content).replaceAll(COLOR_CHAR + "$1"); ++ } ++ // Gale end - Purpur - fix legacy colors in console + int next = content.indexOf(COLOR_CHAR); + int last = content.length() - 1; + if (next == -1 || next == last) { +@@ -209,4 +243,13 @@ public final class HexFormattingConverter extends LogEventPatternConverter { + return new HexFormattingConverter(formatters, strip); + } + ++ // Gale start - Purpur - fix legacy colors in console ++ private static boolean fixLegacyColors() { ++ try { ++ return GaleGlobalConfiguration.get().logToConsole.legacyColors; ++ } catch (NullPointerException ignored) {} ++ return false; ++ } ++ // Gale end - Purpur - fix legacy colors in console ++ + } +diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java +index 24ed4fb7ddacba24873755edfa88912ffdf81cc8..0965f43068d12a85090906568e2c1b731730f015 100644 +--- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java ++++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java +@@ -60,6 +60,7 @@ public class GaleGlobalConfiguration extends ConfigurationPart { + public LogToConsole logToConsole; + public class LogToConsole extends ConfigurationPart.Post { // Gale - EMC - softly log invalid pool element errors + ++ public boolean legacyColors = true; // Gale - Purpur - fix legacy colors in console + public boolean invalidStatistics = true; // Gale - EMC - do not log invalid statistics + public boolean ignoredAdvancements = true; // Gale - Purpur - do not log ignored advancements + public boolean setBlockInFarChunk = true; // Gale - Purpur - do not log setBlock in far chunks diff --git a/patches/server/0054-Fix-outdated-server-showing-in-ping-before-server-fu.patch b/patches/server/0055-Fix-outdated-server-showing-in-ping-before-server-fu.patch similarity index 100% rename from patches/server/0054-Fix-outdated-server-showing-in-ping-before-server-fu.patch rename to patches/server/0055-Fix-outdated-server-showing-in-ping-before-server-fu.patch diff --git a/patches/server/0055-Make-sand-duping-fix-configurable.patch b/patches/server/0056-Make-sand-duping-fix-configurable.patch similarity index 100% rename from patches/server/0055-Make-sand-duping-fix-configurable.patch rename to patches/server/0056-Make-sand-duping-fix-configurable.patch diff --git a/patches/server/0056-Fix-MC-238526.patch b/patches/server/0057-Fix-MC-238526.patch similarity index 100% rename from patches/server/0056-Fix-MC-238526.patch rename to patches/server/0057-Fix-MC-238526.patch diff --git a/patches/server/0057-Fix-MC-123848.patch b/patches/server/0058-Fix-MC-123848.patch similarity index 100% rename from patches/server/0057-Fix-MC-123848.patch rename to patches/server/0058-Fix-MC-123848.patch diff --git a/patches/server/0058-Fix-cow-rotation-when-shearing-mooshroom.patch b/patches/server/0059-Fix-cow-rotation-when-shearing-mooshroom.patch similarity index 100% rename from patches/server/0058-Fix-cow-rotation-when-shearing-mooshroom.patch rename to patches/server/0059-Fix-cow-rotation-when-shearing-mooshroom.patch diff --git a/patches/server/0059-Fix-MC-121706.patch b/patches/server/0060-Fix-MC-121706.patch similarity index 100% rename from patches/server/0059-Fix-MC-121706.patch rename to patches/server/0060-Fix-MC-121706.patch diff --git a/patches/server/0060-Reduce-array-allocations.patch b/patches/server/0061-Reduce-array-allocations.patch similarity index 100% rename from patches/server/0060-Reduce-array-allocations.patch rename to patches/server/0061-Reduce-array-allocations.patch diff --git a/patches/server/0061-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch b/patches/server/0062-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch similarity index 100% rename from patches/server/0061-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch rename to patches/server/0062-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch diff --git a/patches/server/0062-Measure-last-tick-time.patch b/patches/server/0063-Measure-last-tick-time.patch similarity index 100% rename from patches/server/0062-Measure-last-tick-time.patch rename to patches/server/0063-Measure-last-tick-time.patch diff --git a/patches/server/0063-Last-tick-time-API.patch b/patches/server/0064-Last-tick-time-API.patch similarity index 100% rename from patches/server/0063-Last-tick-time-API.patch rename to patches/server/0064-Last-tick-time-API.patch diff --git a/patches/server/0064-Show-last-tick-time-in-tps-command.patch b/patches/server/0065-Show-last-tick-time-in-tps-command.patch similarity index 97% rename from patches/server/0064-Show-last-tick-time-in-tps-command.patch rename to patches/server/0065-Show-last-tick-time-in-tps-command.patch index 8c25e14..678e15d 100644 --- a/patches/server/0064-Show-last-tick-time-in-tps-command.patch +++ b/patches/server/0065-Show-last-tick-time-in-tps-command.patch @@ -12,10 +12,10 @@ As part of: YAPFA (https://github.com/tr7zw/YAPFA) Licensed under: MIT (https://opensource.org/licenses/MIT) diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java -index 24ed4fb7ddacba24873755edfa88912ffdf81cc8..abfceeb28f0f48d4ee8dde47c2354d0e095787e1 100644 +index 0965f43068d12a85090906568e2c1b731730f015..84b7325776b166553b9655e844ad6619d346432e 100644 --- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java +++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java -@@ -90,4 +90,17 @@ public class GaleGlobalConfiguration extends ConfigurationPart { +@@ -91,4 +91,17 @@ public class GaleGlobalConfiguration extends ConfigurationPart { } diff --git a/patches/server/0065-Collision-physics-check-before-vehicle-check.patch b/patches/server/0066-Collision-physics-check-before-vehicle-check.patch similarity index 100% rename from patches/server/0065-Collision-physics-check-before-vehicle-check.patch rename to patches/server/0066-Collision-physics-check-before-vehicle-check.patch diff --git a/patches/server/0066-Variable-main-thread-task-delay.patch b/patches/server/0067-Variable-main-thread-task-delay.patch similarity index 99% rename from patches/server/0066-Variable-main-thread-task-delay.patch rename to patches/server/0067-Variable-main-thread-task-delay.patch index 0af2476..60081e6 100644 --- a/patches/server/0066-Variable-main-thread-task-delay.patch +++ b/patches/server/0067-Variable-main-thread-task-delay.patch @@ -864,7 +864,7 @@ index 0000000000000000000000000000000000000000..4b82aea23b99180f13c71a1797c4d829 + +} diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java -index abfceeb28f0f48d4ee8dde47c2354d0e095787e1..8a4d6082015a014b9377f2a14f483c5773c52571 100644 +index 84b7325776b166553b9655e844ad6619d346432e..0abb81e5a68f75470a0a522fcf1a072a87880feb 100644 --- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java +++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java @@ -2,11 +2,14 @@ diff --git a/patches/server/0067-Reduce-RandomSource-instances.patch b/patches/server/0068-Reduce-RandomSource-instances.patch similarity index 100% rename from patches/server/0067-Reduce-RandomSource-instances.patch rename to patches/server/0068-Reduce-RandomSource-instances.patch diff --git a/patches/server/0068-CPU-cores-estimation.patch b/patches/server/0069-CPU-cores-estimation.patch similarity index 97% rename from patches/server/0068-CPU-cores-estimation.patch rename to patches/server/0069-CPU-cores-estimation.patch index 330e315..21b51f9 100644 --- a/patches/server/0068-CPU-cores-estimation.patch +++ b/patches/server/0069-CPU-cores-estimation.patch @@ -44,10 +44,10 @@ index 7220920bf87a78224c63c017cc4a623f547c7b80..bd77ede11311ebd156b3de5d7297b287 import org.yaml.snakeyaml.constructor.SafeConstructor; import org.yaml.snakeyaml.error.MarkedYAMLException; diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java -index 8a4d6082015a014b9377f2a14f483c5773c52571..232e52e8654b47cc163dd7a46504d45403008f85 100644 +index 0abb81e5a68f75470a0a522fcf1a072a87880feb..da07854b99f7e0e097bd9f6cf18572253052bfdf 100644 --- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java +++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java -@@ -285,6 +285,7 @@ public class GaleGlobalConfiguration extends ConfigurationPart { +@@ -286,6 +286,7 @@ public class GaleGlobalConfiguration extends ConfigurationPart { public boolean setBlockInFarChunk = true; // Gale - Purpur - do not log setBlock in far chunks public boolean unrecognizedRecipes = false; // Gale - Purpur - do not log unrecognized recipes public boolean legacyMaterialInitialization = false; // Gale - Purpur - do not log legacy Material initialization diff --git a/patches/server/0069-Add-centralized-AsyncExecutor.patch b/patches/server/0070-Add-centralized-AsyncExecutor.patch similarity index 100% rename from patches/server/0069-Add-centralized-AsyncExecutor.patch rename to patches/server/0070-Add-centralized-AsyncExecutor.patch diff --git a/patches/server/0070-Remove-Paper-async-executor.patch b/patches/server/0071-Remove-Paper-async-executor.patch similarity index 100% rename from patches/server/0070-Remove-Paper-async-executor.patch rename to patches/server/0071-Remove-Paper-async-executor.patch diff --git a/patches/server/0071-Remove-Paper-cleaner-executor.patch b/patches/server/0072-Remove-Paper-cleaner-executor.patch similarity index 100% rename from patches/server/0071-Remove-Paper-cleaner-executor.patch rename to patches/server/0072-Remove-Paper-cleaner-executor.patch diff --git a/patches/server/0072-Remove-background-executor.patch b/patches/server/0073-Remove-background-executor.patch similarity index 100% rename from patches/server/0072-Remove-background-executor.patch rename to patches/server/0073-Remove-background-executor.patch diff --git a/patches/server/0073-Remove-bootstrap-executor.patch b/patches/server/0074-Remove-bootstrap-executor.patch similarity index 100% rename from patches/server/0073-Remove-bootstrap-executor.patch rename to patches/server/0074-Remove-bootstrap-executor.patch diff --git a/patches/server/0074-Remove-world-upgrade-executors.patch b/patches/server/0075-Remove-world-upgrade-executors.patch similarity index 100% rename from patches/server/0074-Remove-world-upgrade-executors.patch rename to patches/server/0075-Remove-world-upgrade-executors.patch diff --git a/patches/server/0075-Remove-tab-complete-executor.patch b/patches/server/0076-Remove-tab-complete-executor.patch similarity index 100% rename from patches/server/0075-Remove-tab-complete-executor.patch rename to patches/server/0076-Remove-tab-complete-executor.patch diff --git a/patches/server/0076-Remove-text-filter-executor.patch b/patches/server/0077-Remove-text-filter-executor.patch similarity index 100% rename from patches/server/0076-Remove-text-filter-executor.patch rename to patches/server/0077-Remove-text-filter-executor.patch