Skip to content

Commit

Permalink
api(virtual): remove potentially surprising logic in component rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
zml2008 committed Dec 14, 2024
1 parent 31acdb9 commit 9d2e952
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.TranslatableComponent;
import net.kyori.adventure.text.VirtualComponent;
import net.kyori.adventure.text.VirtualComponentRenderer;
import org.jetbrains.annotations.NotNull;

/**
Expand Down Expand Up @@ -142,12 +141,8 @@ public abstract class AbstractComponentRenderer<C> implements ComponentRenderer<
* @return the rendered component
* @since 4.18.0
*/
@SuppressWarnings("unchecked")
protected @NotNull Component renderVirtual(final @NotNull VirtualComponent component, final @NotNull C context) {
if (component.contextType().isInstance(context)) {
return ((VirtualComponentRenderer<C>) component.renderer()).apply(context).asComponent();
}
return component; // will be processed as a TextComponent instead
return component;
}

/**
Expand Down

0 comments on commit 9d2e952

Please sign in to comment.