mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 08:36:45 +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
|
//Message to be sent when a player joins
|
||||||
public void onPlayerJoin(PlayerEvent event) {
|
public void onPlayerJoin(PlayerEvent event) {
|
||||||
Player player = event.getPlayer();
|
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
|
//Message to be sent when a player uses /list
|
||||||
public void onPlayerCommand(PlayerChatEvent event) {
|
public void onPlayerCommand(PlayerChatEvent event) {
|
||||||
@ -44,12 +45,14 @@ public class vPlayerListener extends PlayerListener {
|
|||||||
int x = 0;
|
int x = 0;
|
||||||
for(Player p : plugin.getServer().getOnlinePlayers())
|
for(Player p : plugin.getServer().getOnlinePlayers())
|
||||||
{
|
{
|
||||||
|
if(p != null && x+1 == playerCount()){
|
||||||
|
tempList+= p.getName();
|
||||||
|
x++;
|
||||||
|
}
|
||||||
if(p != null && x < playerCount()){
|
if(p != null && x < playerCount()){
|
||||||
tempList+= p.getName() +", ";
|
tempList+= p.getName() +", ";
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
if(x >= playerCount())
|
|
||||||
tempList+= p.getName();
|
|
||||||
}
|
}
|
||||||
//Output the player list
|
//Output the player list
|
||||||
player.sendMessage(ChatColor.RED + "Player List ("+ChatColor.WHITE + tempList +ChatColor.RED+")");
|
player.sendMessage(ChatColor.RED + "Player List ("+ChatColor.WHITE + tempList +ChatColor.RED+")");
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
name: vPlayersOnline
|
name: vPlayersOnline
|
||||||
main: com.bukkit.nossr50.vPlayersOnline.vPlayersOnline
|
main: com.bukkit.nossr50.vPlayersOnline.vPlayersOnline
|
||||||
version: 1.2
|
version: 1.3
|
Loading…
Reference in New Issue
Block a user