diff --git a/vPlayersOnline/com/bukkit/nossr50/vPlayersOnline/vPlayerListener.java b/vPlayersOnline/com/bukkit/nossr50/vPlayersOnline/vPlayerListener.java index c5f3f6156..5f4ba3830 100644 --- a/vPlayersOnline/com/bukkit/nossr50/vPlayersOnline/vPlayerListener.java +++ b/vPlayersOnline/com/bukkit/nossr50/vPlayersOnline/vPlayerListener.java @@ -36,20 +36,24 @@ public class vPlayerListener extends PlayerListener { } //Message to be sent when a player uses /list public void onPlayerCommand(PlayerChatEvent event) { - log.log(Level.INFO, event.getMessage() + "|" + event.getPlayer().getName()); String[] split = event.getMessage().split(" "); Player player = event.getPlayer(); if(split[0].equalsIgnoreCase("/list") || split[0].equalsIgnoreCase("/who")){ event.setCancelled(true); String tempList = ""; + int x = 0; for(Player p : plugin.getServer().getOnlinePlayers()) { - if(p != null){ - tempList+= p.getName(); + if(p != null && x < playerCount()){ + tempList+= p.getName() +", "; + x++; } + if(x >= playerCount()) + tempList+= p.getName(); } //Output the player list - player.sendMessage(ChatColor.RED + "Player List (" + tempList +")"); + player.sendMessage(ChatColor.RED + "Player List ("+ChatColor.WHITE + tempList +ChatColor.RED+")"); + player.sendMessage(ChatColor.RED + "Total Players: " + ChatColor.GREEN + playerCount()); } } } diff --git a/vPlayersOnline/com/bukkit/nossr50/vPlayersOnline/vPlayersOnline.java b/vPlayersOnline/com/bukkit/nossr50/vPlayersOnline/vPlayersOnline.java index 68a95edd2..771fa99ef 100644 --- a/vPlayersOnline/com/bukkit/nossr50/vPlayersOnline/vPlayersOnline.java +++ b/vPlayersOnline/com/bukkit/nossr50/vPlayersOnline/vPlayersOnline.java @@ -33,6 +33,7 @@ public class vPlayersOnline extends JavaPlugin { PluginManager pm = getServer().getPluginManager(); pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this); + pm.registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this); //Displays a message when plugin is loaded PluginDescriptionFile pdfFile = this.getDescription(); System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" ); diff --git a/vPlayersOnline/plugin.yml b/vPlayersOnline/plugin.yml index c8e65c540..3d3d62e2a 100644 --- a/vPlayersOnline/plugin.yml +++ b/vPlayersOnline/plugin.yml @@ -1,3 +1,3 @@ name: vPlayersOnline main: com.bukkit.nossr50.vPlayersOnline.vPlayersOnline -version: 1.1 \ No newline at end of file +version: 1.2 \ No newline at end of file