Improve way titles are sent to players

This commit is contained in:
William committed 2023-10-13 18:53:06 +01:00
1 parent eccefac9a1
commit d951223364
2 files changed
+7 -5

No files matched your search

@@ -26,7 +26,7 @@ import net.kyori.adventure.key.InvalidKeyException;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import net.kyori.adventure.sound.Sound; import net.kyori.adventure.sound.Sound;
import net.kyori.adventure.text.Component; 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.config.Locales;
import net.william278.huskhomes.position.Location; import net.william278.huskhomes.position.Location;
import net.william278.huskhomes.position.Position; import net.william278.huskhomes.position.Position;
@@ -90,9 +90,11 @@ public abstract class OnlineUser extends User implements Teleportable, CommandUs
* @param subTitle whether to send the title as a subtitle ({@code true} for a subtitle, {@code false} for a title) * @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) { public void sendTitle(@NotNull MineDown mineDown, boolean subTitle) {
getAudience().sendTitlePart(subTitle ? TitlePart.SUBTITLE : TitlePart.TITLE, mineDown final Component message = mineDown.disable(MineDownParser.Option.SIMPLE_FORMATTING).replace().toComponent();
.disable(MineDownParser.Option.SIMPLE_FORMATTING) getAudience().showTitle(Title.title(
.replace().toComponent()); subTitle ? Component.empty() : message,
subTitle ? message : Component.empty()
));
} }
/** /**
+1 -1
View File
@@ -3,7 +3,7 @@ javaVersion=16
org.gradle.jvmargs='-Dfile.encoding=UTF-8' org.gradle.jvmargs='-Dfile.encoding=UTF-8'
org.gradle.daemon=true org.gradle.daemon=true
plugin_version=4.5.2 plugin_version=4.5.3
plugin_archive=huskhomes plugin_archive=huskhomes
plugin_description=The powerful and intuitive homes, warps, and teleports plugin/mod plugin_description=The powerful and intuitive homes, warps, and teleports plugin/mod