Fix leaking piston codes via update

Fixes #1436
This commit is contained in:
Octavia Togami 2020-07-12 11:56:33 -07:00
parent 9d9aaac15a
commit 6845e86fdf
No known key found for this signature in database
GPG Key ID: CC364524D1983C99
2 changed files with 7 additions and 2 deletions

View File

@ -3,7 +3,7 @@
object Versions { object Versions {
const val TEXT = "3.0.4" const val TEXT = "3.0.4"
const val TEXT_EXTRAS = "3.0.5" 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 AUTO_VALUE = "1.7"
const val JUNIT = "5.6.1" const val JUNIT = "5.6.1"
const val MOCKITO = "3.3.3" const val MOCKITO = "3.3.3"

View File

@ -22,12 +22,14 @@
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.Component;
import org.enginehub.piston.config.ConfigHolder; import org.enginehub.piston.config.ConfigHolder;
import org.enginehub.piston.config.ConfigRenderer;
import org.enginehub.piston.config.TextConfig; import org.enginehub.piston.config.TextConfig;
import org.enginehub.piston.util.TextHelper; import org.enginehub.piston.util.TextHelper;
import java.util.Locale; import java.util.Locale;
public class WorldEditText { public class WorldEditText {
private static final ConfigRenderer RENDERER = ConfigRenderer.getInstance();
public static final ConfigHolder CONFIG_HOLDER = ConfigHolder.create(); public static final ConfigHolder CONFIG_HOLDER = ConfigHolder.create();
static { static {
@ -35,7 +37,10 @@ public class WorldEditText {
} }
public static Component format(Component component, Locale locale) { 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) { public static String reduceToText(Component component, Locale locale) {