mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Fixed the last player name duping bug
This commit is contained in:
parent
7deb6f3e84
commit
5b44f81fca
@ -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+")");
|
||||
|
@ -1,3 +1,3 @@
|
||||
name: vPlayersOnline
|
||||
main: com.bukkit.nossr50.vPlayersOnline.vPlayersOnline
|
||||
version: 1.2
|
||||
version: 1.3
|
Loading…
Reference in New Issue
Block a user