Close #518 - use csv method for perms command

This commit is contained in:
md_5 2013-09-07 12:22:43 +10:00
parent 89edb00c05
commit ccdf2a89d8

View File

@ -2,6 +2,7 @@ package net.md_5.bungee.command;
import java.util.HashSet;
import java.util.Set;
import net.md_5.bungee.Util;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
@ -18,15 +19,12 @@ public class CommandPerms extends Command
@Override
public void execute(CommandSender sender, String[] args)
{
StringBuilder groups = new StringBuilder();
Set<String> permissions = new HashSet<>();
for ( String group : sender.getGroups() )
{
groups.append( group );
groups.append( ", " );
permissions.addAll( ProxyServer.getInstance().getConfigurationAdapter().getPermissions( group ) );
}
sender.sendMessage( ChatColor.GOLD + "You have the following groups: " + groups.substring( 0, groups.length() - 2 ) );
sender.sendMessage( ChatColor.GOLD + "You have the following groups: " + Util.csv( sender.getGroups() ) );
for ( String permission : permissions )
{