Skip to content

Commit

Permalink
Ensure plain hover text
Browse files Browse the repository at this point in the history
  • Loading branch information
Protonull committed Nov 19, 2024
1 parent 67ecd31 commit d8d1449
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public abstract class InterceptCtiMixin {
if (this.level == null) {
return;
}
final String plainMessage = packet.content().getString().replaceAll("§.", "");
final String plainMessage = getComponentPlainText(packet.content());
if (!plainMessage.equals("Not reinforced") && !plainMessage.startsWith("Reinforced at ")) {
return;
}
Expand Down Expand Up @@ -87,11 +87,17 @@ public abstract class InterceptCtiMixin {
if (hoverText == null || Component.EMPTY.equals(hoverText)) {
continue;
}
final String hoverContent = hoverText.getString();
hovers.addAll(List.of(
hoverContent.split("\n")
));
hovers.addAll(
List.of(getComponentPlainText(hoverText).split("\n"))
);
}
return hovers;
}

@Unique
private static @NotNull String getComponentPlainText(
final @NotNull Component component
) {
return component.getString().replaceAll("§.", "").trim();
}
}

0 comments on commit d8d1449

Please sign in to comment.