Skip to content

Commit

Permalink
Improve way titles are sent to players
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Oct 13, 2023
1 parent eccefac commit d951223
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit d951223

Please sign in to comment.