mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-10 17:52:02 -07:00
Replace getOnlinePlayers to provide a view. Adds BUKKIT-5668
By: Wesley Wolfe <wesley.d.wolfe+git@gmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.command.defaults;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
@@ -23,7 +24,7 @@ public class ListCommand extends VanillaCommand {
|
||||
|
||||
StringBuilder online = new StringBuilder();
|
||||
|
||||
Player[] players = Bukkit.getOnlinePlayers();
|
||||
final Collection<? extends Player> players = Bukkit.getOnlinePlayers();
|
||||
|
||||
for (Player player : players) {
|
||||
// If a player is hidden from the sender don't show them in the list
|
||||
@@ -37,7 +38,7 @@ public class ListCommand extends VanillaCommand {
|
||||
online.append(player.getDisplayName());
|
||||
}
|
||||
|
||||
sender.sendMessage("There are " + players.length + "/" + Bukkit.getMaxPlayers() + " players online:\n" + online.toString());
|
||||
sender.sendMessage("There are " + players.size() + "/" + Bukkit.getMaxPlayers() + " players online:\n" + online.toString());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user