24package com.dreamfirestudios.dreamcore.DreamTitle;
26import com.dreamfirestudios.dreamcore.DreamChat.DreamMessageFormatter;
27import com.dreamfirestudios.dreamcore.DreamChat.DreamMessageSettings;
28import net.kyori.adventure.text.Component;
29import net.kyori.adventure.title.Title;
30import org.bukkit.Bukkit;
31import org.bukkit.entity.Player;
33import java.time.Duration;
57 public static void sendTitleToPlayer(String title, String subtitle,
int fadeIn,
int stay,
int fadeOut){
58 for (var player : Bukkit.getOnlinePlayers())
76 public static void sendTitleToPlayer(Player player, String title, String subtitle,
int fadeIn,
int stay,
int fadeOut) {
77 if (player ==
null)
return;
78 Component compTitle = DreamMessageFormatter.format(title ==
null ?
"" : title, player, DreamMessageSettings.all());
79 Component compSub = DreamMessageFormatter.format(subtitle ==
null ?
"" : subtitle, player, DreamMessageSettings.all());
80 player.showTitle(Title.title(
83 Title.Times.times(Duration.ofSeconds(fadeIn), Duration.ofSeconds(stay), Duration.ofSeconds(fadeOut))
Convenience helpers for sending Adventure titles to players.
static void sendTitleToPlayer(String title, String subtitle, int fadeIn, int stay, int fadeOut)
Sends a title to all online players.
static void sendTitleToPlayer(Player player, String title, String subtitle, int fadeIn, int stay, int fadeOut)
Sends a title to a single player.