From d951223364b3d703c366c72028281a3036f65b5e Mon Sep 17 00:00:00 2001 From: William Date: Fri, 13 Oct 2023 18:53:06 +0100 Subject: [PATCH] Improve way titles are sent to players --- .../java/net/william278/huskhomes/user/OnlineUser.java | 10 ++++++---- gradle.properties | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/net/william278/huskhomes/user/OnlineUser.java b/common/src/main/java/net/william278/huskhomes/user/OnlineUser.java index 25581be6a..94bb43878 100644 --- a/common/src/main/java/net/william278/huskhomes/user/OnlineUser.java +++ b/common/src/main/java/net/william278/huskhomes/user/OnlineUser.java @@ -26,7 +26,7 @@ import net.kyori.adventure.key.Key; import net.kyori.adventure.sound.Sound; import net.kyori.adventure.text.Component; -import net.kyori.adventure.title.TitlePart; +import net.kyori.adventure.title.Title; import net.william278.huskhomes.config.Locales; import net.william278.huskhomes.position.Location; import net.william278.huskhomes.position.Position; @@ -90,9 +90,11 @@ public OnlineUser(@NotNull UUID uuid, @NotNull String username) { * @param subTitle whether to send the title as a subtitle ({@code true} for a subtitle, {@code false} for a title) */ public void sendTitle(@NotNull MineDown mineDown, boolean subTitle) { - getAudience().sendTitlePart(subTitle ? TitlePart.SUBTITLE : TitlePart.TITLE, mineDown - .disable(MineDownParser.Option.SIMPLE_FORMATTING) - .replace().toComponent()); + final Component message = mineDown.disable(MineDownParser.Option.SIMPLE_FORMATTING).replace().toComponent(); + getAudience().showTitle(Title.title( + subTitle ? Component.empty() : message, + subTitle ? message : Component.empty() + )); } /** diff --git a/gradle.properties b/gradle.properties index 699c9d1f9..24193d01b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ javaVersion=16 org.gradle.jvmargs='-Dfile.encoding=UTF-8' org.gradle.daemon=true -plugin_version=4.5.2 +plugin_version=4.5.3 plugin_archive=huskhomes plugin_description=The powerful and intuitive homes, warps, and teleports plugin/mod