#Newbie/ Server Join Messages

1 messages · Page 1 of 1 (latest)

sacred fjord
#

import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.TextColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;

public class JoinListener implements Listener {

@EventHandler
public void onPlayerJoinEvent(PlayerJoinEvent event) {
    Player player = event.getPlayer();
    event.joinMessage(Component.text("Welcome!"));
}

}
so I haven't run this code above, it has no errors so I think it will work, but is there a way to run the joinmessage without using adventureAPI components? because setjoinmessage is deprecated for bukkit and the new bukkit joinmessage only takes adventure components. im just wondering if I need to bring in this new dependancy, unless its alr installed alongside bukkit idek

cosmic peak
#

Spigot only allows you to set a String as the message, so not really.
You could cancel the event and send a message with components to all online users, though if you're using Paper's API with Adventure, I'd just go with it as it's a lot easier and cleaner