diff options
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandlist.java')
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandlist.java | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java index 98066d7e7..549f6efac 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java @@ -1,17 +1,12 @@ package com.earth2me.essentials.commands; +import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.User; +import java.util.*; +import org.bukkit.ChatColor; import org.bukkit.Server; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import com.earth2me.essentials.User; -import com.earth2me.essentials.Util; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.bukkit.ChatColor; public class Commandlist extends EssentialsCommand @@ -22,7 +17,7 @@ public class Commandlist extends EssentialsCommand } @Override - public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception { boolean showhidden = false; if (sender instanceof Player) @@ -37,15 +32,15 @@ public class Commandlist extends EssentialsCommand showhidden = true; } int playerHidden = 0; - for (Player p : server.getOnlinePlayers()) + for (Player onlinePlayer : server.getOnlinePlayers()) { - if (ess.getUser(p).isHidden()) + if (ess.getUser(onlinePlayer).isHidden()) { playerHidden++; } } //TODO: move these to messages file - StringBuilder online = new StringBuilder(); + final StringBuilder online = new StringBuilder(); online.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().length - playerHidden); if (showhidden && playerHidden > 0) { @@ -58,29 +53,29 @@ public class Commandlist extends EssentialsCommand if (ess.getSettings().getSortListByGroups()) { Map<String, List<User>> sort = new HashMap<String, List<User>>(); - for (Player p : server.getOnlinePlayers()) + for (Player OnlinePlayer : server.getOnlinePlayers()) { - User u = ess.getUser(p); - if (u.isHidden() && !showhidden) + final User player = ess.getUser(OnlinePlayer); + if (player.isHidden() && !showhidden) { continue; } - String group = u.getGroup(); + final String group = player.getGroup(); List<User> list = sort.get(group); if (list == null) { list = new ArrayList<User>(); sort.put(group, list); } - list.add(u); + list.add(player); } - String[] groups = sort.keySet().toArray(new String[0]); + final String[] groups = sort.keySet().toArray(new String[0]); Arrays.sort(groups, String.CASE_INSENSITIVE_ORDER); for (String group : groups) { - StringBuilder groupString = new StringBuilder(); + final StringBuilder groupString = new StringBuilder(); groupString.append(group).append(": "); - List<User> users = sort.get(group); + final List<User> users = sort.get(group); Collections.sort(users); boolean first = true; for (User user : users) @@ -109,20 +104,20 @@ public class Commandlist extends EssentialsCommand } else { - List<User> users = new ArrayList<User>(); - for (Player p : server.getOnlinePlayers()) + final List<User> users = new ArrayList<User>(); + for (Player OnlinePlayer : server.getOnlinePlayers()) { - final User u = ess.getUser(p); - if (u.isHidden() && !showhidden) + final User player = ess.getUser(OnlinePlayer); + if (player.isHidden() && !showhidden) { continue; } - users.add(u); + users.add(player); } Collections.sort(users); - StringBuilder onlineUsers = new StringBuilder(); - onlineUsers.append(Util.i18n("connectedPlayers")); + final StringBuilder onlineUsers = new StringBuilder(); + onlineUsers.append(_("connectedPlayers")); boolean first = true; for (User user : users) { |