diff --git a/src/main/java/xyz/etztech/qol/QoL.java b/src/main/java/xyz/etztech/qol/QoL.java index 1ba18d1..579c07d 100644 --- a/src/main/java/xyz/etztech/qol/QoL.java +++ b/src/main/java/xyz/etztech/qol/QoL.java @@ -14,6 +14,7 @@ import xyz.etztech.qol.other.TPSRunnable; import java.util.ArrayList; import java.util.List; +import java.util.UUID; import java.util.logging.Logger; public class QoL extends JavaPlugin { @@ -52,6 +53,8 @@ public class QoL extends JavaPlugin { getServer().getPluginManager().registerEvents(asyncPlayerChatListener, this); LoginListener loginListener = new LoginListener(this); getServer().getPluginManager().registerEvents(loginListener, this); + JoinListener joinListener = new JoinListener(this); + getServer().getPluginManager().registerEvents(joinListener, this); BlockIgniteListener blockIgniteListener = new BlockIgniteListener(this); getServer().getPluginManager().registerEvents(blockIgniteListener, this); CommandPreprocessListener commandPreprocessListener = new CommandPreprocessListener(this); diff --git a/src/main/java/xyz/etztech/qol/commands/ListCommand.java b/src/main/java/xyz/etztech/qol/commands/ListCommand.java index 41ac428..4bd6b1b 100644 --- a/src/main/java/xyz/etztech/qol/commands/ListCommand.java +++ b/src/main/java/xyz/etztech/qol/commands/ListCommand.java @@ -49,7 +49,7 @@ public class ListCommand implements CommandExecutor { parts.set(i, StringUtils.capitalize(parts.get(i))); } List names = list.get(key); - message.append(ChatColor.GOLD) + message.append("\n").append(ChatColor.GOLD) .append(StringUtils.join(parts, " ")) .append(" (") @@ -59,8 +59,7 @@ public class ListCommand implements CommandExecutor { .append("): ") .append(ChatColor.YELLOW) - .append(StringUtils.join(names, ", ")) - .append("\n"); + .append(StringUtils.join(names, ", ")); } commandSender.sendMessage(message.toString()); diff --git a/src/main/java/xyz/etztech/qol/listeners/JoinListener.java b/src/main/java/xyz/etztech/qol/listeners/JoinListener.java new file mode 100644 index 0000000..247cd76 --- /dev/null +++ b/src/main/java/xyz/etztech/qol/listeners/JoinListener.java @@ -0,0 +1,40 @@ +package xyz.etztech.qol.listeners; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import xyz.etztech.qol.QoL; + +public class JoinListener implements Listener { + + private QoL plugin; + + public JoinListener(QoL plugin) { + this.plugin = plugin; + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) { + + // First login + final Player player = event.getPlayer(); + if (!player.hasPlayedBefore()) { + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> { + for (Player p : Bukkit.getServer().getOnlinePlayers()) { + if (player != p) { + p.sendMessage(ChatColor.GREEN + player.getName() + " is new here! Be sure to welcome them!"); + } else { + p.sendMessage(ChatColor.GREEN + "Welcome, " + player.getName() + "! Check out /rules and then /apply!"); + } + } + }, 30); // ~1.5 seconds + + + } + } + +} diff --git a/src/main/java/xyz/etztech/qol/listeners/LoginListener.java b/src/main/java/xyz/etztech/qol/listeners/LoginListener.java index 6a76ec1..d4df350 100644 --- a/src/main/java/xyz/etztech/qol/listeners/LoginListener.java +++ b/src/main/java/xyz/etztech/qol/listeners/LoginListener.java @@ -34,16 +34,6 @@ public class LoginListener implements Listener { } } - // First login - if (!player.hasPlayedBefore()) { - for (Player p : Bukkit.getServer().getOnlinePlayers()) { - if (p != player) { - p.sendMessage(ChatColor.YELLOW + player.getName() + " is new here!"); - } else { - p.sendMessage(ChatColor.YELLOW + "Welcome, " + p.getName() + "! Check out /rules and then /apply!"); - } - } - } } }