mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Fixed "list" to not show junk in console.
This commit is contained in:
parent
e16a909668
commit
5c5a0acd18
@ -101,35 +101,43 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("listreal") || cmd.getName().equalsIgnoreCase("list"))
|
else if(cmd.getName().equalsIgnoreCase("listreal") || cmd.getName().equalsIgnoreCase("list"))
|
||||||
{
|
{
|
||||||
StringBuilder online = new StringBuilder();
|
StringBuilder onlineStats = new StringBuilder();
|
||||||
online.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(Bukkit.getOnlinePlayers().length);
|
|
||||||
online.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(Bukkit.getMaxPlayers());
|
|
||||||
online.append(ChatColor.BLUE).append(" players online.");
|
|
||||||
sender.sendMessage(online.toString());
|
|
||||||
|
|
||||||
StringBuilder onlineUsers = new StringBuilder();
|
StringBuilder onlineUsers = new StringBuilder();
|
||||||
onlineUsers.append("Connected players: ");
|
|
||||||
boolean first = true;
|
if (player == null)
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
|
||||||
{
|
{
|
||||||
if (first)
|
onlineStats.append(String.format("There are %d out of a maximum %d players online.", Bukkit.getOnlinePlayers().length, Bukkit.getMaxPlayers()));
|
||||||
{
|
|
||||||
first = false;
|
onlineUsers.append("Connected players: ");
|
||||||
}
|
boolean first = true;
|
||||||
else
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
{
|
|
||||||
onlineUsers.append(", ");
|
|
||||||
}
|
|
||||||
if (p.isOp())
|
|
||||||
{
|
|
||||||
onlineUsers.append(ChatColor.RED).append(p.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
if (first) first = false;
|
||||||
|
else onlineUsers.append(", ");
|
||||||
onlineUsers.append(p.getName());
|
onlineUsers.append(p.getName());
|
||||||
}
|
}
|
||||||
onlineUsers.append(ChatColor.WHITE);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(Bukkit.getOnlinePlayers().length);
|
||||||
|
onlineStats.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(Bukkit.getMaxPlayers());
|
||||||
|
onlineStats.append(ChatColor.BLUE).append(" players online.");
|
||||||
|
|
||||||
|
onlineUsers.append("Connected players: ");
|
||||||
|
boolean first = true;
|
||||||
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
if (first) first = false;
|
||||||
|
else onlineUsers.append(", ");
|
||||||
|
|
||||||
|
if (p.isOp()) onlineUsers.append(ChatColor.RED).append(p.getName());
|
||||||
|
else onlineUsers.append(p.getName());
|
||||||
|
|
||||||
|
onlineUsers.append(ChatColor.WHITE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(onlineStats.toString());
|
||||||
sender.sendMessage(onlineUsers.toString());
|
sender.sendMessage(onlineUsers.toString());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user