Fixed the last player name duping bug

This commit is contained in:
nossr50 2011-01-15 21:50:28 -08:00
parent 7deb6f3e84
commit 5b44f81fca
2 changed files with 7 additions and 4 deletions

View File

@ -32,7 +32,8 @@ public class vPlayerListener extends PlayerListener {
//Message to be sent when a player joins
public void onPlayerJoin(PlayerEvent event) {
Player player = event.getPlayer();
player.sendMessage(ChatColor.GREEN + "There are " + playerCount() + " players online");
//English Version
player.sendMessage(ChatColor.GREEN + "There are " + playerCount() + " players online.");
}
//Message to be sent when a player uses /list
public void onPlayerCommand(PlayerChatEvent event) {
@ -44,12 +45,14 @@ public class vPlayerListener extends PlayerListener {
int x = 0;
for(Player p : plugin.getServer().getOnlinePlayers())
{
if(p != null && x+1 == playerCount()){
tempList+= p.getName();
x++;
}
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 ("+ChatColor.WHITE + tempList +ChatColor.RED+")");

View File

@ -1,3 +1,3 @@
name: vPlayersOnline
main: com.bukkit.nossr50.vPlayersOnline.vPlayersOnline
version: 1.2
version: 1.3