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 {
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"

View File

@ -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) {