From 6845e86fdf0e6a221a9780babe022e552637c4d5 Mon Sep 17 00:00:00 2001 From: Octavia Togami Date: Sun, 12 Jul 2020 11:56:33 -0700 Subject: [PATCH] Fix leaking piston codes via update Fixes #1436 --- buildSrc/src/main/kotlin/Versions.kt | 2 +- .../com/sk89q/worldedit/util/formatting/WorldEditText.java | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 4b3bb46e9..3985105db 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -3,7 +3,7 @@ object Versions { const val TEXT = "3.0.4" const val TEXT_EXTRAS = "3.0.5" - const val PISTON = "0.5.5" + const val PISTON = "0.5.6" const val AUTO_VALUE = "1.7" const val JUNIT = "5.6.1" const val MOCKITO = "3.3.3" diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/WorldEditText.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/WorldEditText.java index e448926fc..334f7c2d4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/WorldEditText.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/WorldEditText.java @@ -22,12 +22,14 @@ import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.util.formatting.text.Component; import org.enginehub.piston.config.ConfigHolder; +import org.enginehub.piston.config.ConfigRenderer; import org.enginehub.piston.config.TextConfig; import org.enginehub.piston.util.TextHelper; import java.util.Locale; public class WorldEditText { + private static final ConfigRenderer RENDERER = ConfigRenderer.getInstance(); public static final ConfigHolder CONFIG_HOLDER = ConfigHolder.create(); static { @@ -35,7 +37,10 @@ public class WorldEditText { } public static Component format(Component component, Locale locale) { - return WorldEdit.getInstance().getTranslationManager().convertText(CONFIG_HOLDER.replace(component), locale); + return WorldEdit.getInstance().getTranslationManager().convertText( + RENDERER.render(component, CONFIG_HOLDER), + locale + ); } public static String reduceToText(Component component, Locale locale) {