diff --git a/src/main/java/de/themoep/minedown/Replacer.java b/src/main/java/de/themoep/minedown/Replacer.java index 32f3d30..3ba6904 100644 --- a/src/main/java/de/themoep/minedown/Replacer.java +++ b/src/main/java/de/themoep/minedown/Replacer.java @@ -221,11 +221,18 @@ public BaseComponent[] replaceIn(List components) { ((TextComponent) component).setText(""); List extra = new ArrayList<>(); Collections.addAll(extra, replacedComponent); - extra.addAll(component.getExtra()); + if (component.getExtra() != null) { + Collections.addAll(extra, replaceIn(component.getExtra())); + } component.setExtra(extra); } else { ((TextComponent) component).setText(replaced); + if (component.getExtra() != null) { + component.setExtra(Arrays.asList(replaceIn(component.getExtra()))); + } } + } else if (component.getExtra() != null) { + component.setExtra(Arrays.asList(replaceIn(component.getExtra()))); } if (component instanceof TranslatableComponent) { ((TranslatableComponent) component).setTranslate(replaceIn(((TranslatableComponent) component).getTranslate())); @@ -257,9 +264,6 @@ public BaseComponent[] replaceIn(List components) { } } } - if (component.getExtra() != null) { - component.setExtra(Arrays.asList(replaceIn(component.getExtra()))); - } // Component replacements List replacedComponents = new ArrayList<>();