diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java index 57fc80a73..9a89831c2 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java @@ -105,6 +105,7 @@ public class BungeeCord extends ProxyServer getPluginManager().registerCommand( new CommandIP() ); getPluginManager().registerCommand( new CommandAlert() ); getPluginManager().registerCommand( new CommandBungee() ); + getPluginManager().registerCommand( new CommandPerms() ); registerChannel( "BungeeCord" ); } diff --git a/proxy/src/main/java/net/md_5/bungee/command/CommandPerms.java b/proxy/src/main/java/net/md_5/bungee/command/CommandPerms.java new file mode 100644 index 000000000..79d74d147 --- /dev/null +++ b/proxy/src/main/java/net/md_5/bungee/command/CommandPerms.java @@ -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 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 ); + } + } +}