Add perm debug command

This commit is contained in:
md_5 2013-02-10 17:41:34 +11:00
parent affecd858a
commit 154722eacc
2 changed files with 37 additions and 0 deletions

View File

@ -105,6 +105,7 @@ public class BungeeCord extends ProxyServer
getPluginManager().registerCommand( new CommandIP() ); getPluginManager().registerCommand( new CommandIP() );
getPluginManager().registerCommand( new CommandAlert() ); getPluginManager().registerCommand( new CommandAlert() );
getPluginManager().registerCommand( new CommandBungee() ); getPluginManager().registerCommand( new CommandBungee() );
getPluginManager().registerCommand( new CommandPerms() );
registerChannel( "BungeeCord" ); registerChannel( "BungeeCord" );
} }

View File

@ -0,0 +1,36 @@
package net.md_5.bungee.command;
import java.util.HashSet;
import java.util.Set;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.plugin.Command;
public class CommandPerms extends Command
{
public CommandPerms()
{
super( "perms" );
}
@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 ) );
for ( String permission : permissions )
{
sender.sendMessage( ChatColor.BLUE + "- " + permission );
}
}
}