mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
Improve way titles are sent to players
This commit is contained in:
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.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 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)
|
||||
*/
|
||||
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()
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user