So basically, I want it so the PlayerJoinEvent sends the message of the day, here is what I have done so far: Code (Text): @EventHandler public void onJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); //So this sends first, at the moment it is sending this AFTER the 'welcome back.. ' part. event.setJoinMessage(ChatColor.GREEN + "+" + ChatColor.GRAY + player.getName()); //motd player.sendMessage("Welcome back" + player.getName()); }
Put a BukkitRunnable around your sendMessage line, Code (Text): new BukkitRunnable() { @Override public void run() { // TODO send message } }.runTask(plugin); Should do the job
Sorry - another question why can't I do this: Code (Text): player.sendMessage(ChatColor.GOLD + ChatColor.STRIKETHROUGH + ChatColor.BOLD + "================================"); I this error: The operator + is undefined for the type of arguement(s)
Code (Text): p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&5&m&l==============================")); ?
Thanks Will this work..? Code (Text): @EventHandler public void onJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); event.setJoinMessage(ChatColor.GREEN + "+ " + ChatColor.GRAY + player.getName()); new BukkitRunnable() { @Override public void run() { player.sendMessage(ChatColor.GOLD + ChatColor.STRIKETHROUGH.toString() + ChatColor.BOLD + "================================"); } }; }
Code (Text): new BukkitRunnable() { @Override public void run() { player.sendMessage(ChatColor.GOLD + ChatColor.STRIKETHROUGH.toString() + ChatColor.BOLD + "================================"); } }.runTask(plugin);
Er..? Code (Text): public class PlayerListener extends JavaPlugin { //code }.runTask(PlayerListener); Still underlined red.
@Moderance Code (Java): ChatColor.GOLD + "" + ChatColor.BOLD; is also edible but if you want some short way Code (Java): ChatColor.translateAlternateColorCodes('&', String message);
Yes, I noticed \n doesn't work now I am using the .translateAlternateColorCodes do you know what I can use instead?
hmm same problem with me but I did Code (Java): .replace("%n", \n); now perfectly works I'm not sure if it would work to you.