package stream.flarebot.flarebot.commands.general;

import net.dv8tion.jda.core.entities.Member;
import net.dv8tion.jda.core.entities.Message;
import net.dv8tion.jda.core.entities.TextChannel;
import net.dv8tion.jda.core.entities.User;
import stream.flarebot.flarebot.FlareBot;
import stream.flarebot.flarebot.commands.Command;
import stream.flarebot.flarebot.commands.CommandType;
import stream.flarebot.flarebot.objects.GuildWrapper;
import stream.flarebot.flarebot.permissions.PerGuildPermissions;
import stream.flarebot.flarebot.util.MessageUtils;

public class CommandUsageCommand implements Command {

    @Override
    public void onCommand(User sender, GuildWrapper guild, TextChannel channel, Message message, String[] args, Member member) {
        if (args.length == 0) {
            MessageUtils.sendUsage(this, channel, sender, args);
        } else {
            Command c = FlareBot.getInstance().getCommand(args[0], sender);
            if (c == null || (c.getType() == CommandType.SECRET && !PerGuildPermissions.isCreator(sender))) {
                MessageUtils.sendErrorMessage("That is not a command!", channel);
            } else {
                MessageUtils.sendUsage(c, channel, sender, new String[]{});
            }
        }
    }

    @Override
    public String getCommand() {
        return "usage";
    }

    @Override
    public String getDescription() {
        return "Allows you to view usages for other commands";
    }

    @Override
    public String getUsage() {
        return "`{%}usage <command_name>` - Displays the usage for another command.";
    }

    @Override
    public CommandType getType() {
        return CommandType.GENERAL;
    }
}

@@ -954,98 +954,34 @@
 if (
-c == null %7C%7C (c.getType() == CommandType.SECRET && !PerGuildPermissions.isCreator(
+!canRunCommand(c, 
 sender))
 ) %7B%0A
@@ -976,19 +976,16 @@
 sender))
-) %7B
 %0A       
@@ -1166,24 +1166,24 @@
           %7D%0A
-
         %7D%0A  
@@ -1181,24 +1181,517 @@
      %7D%0A    %7D
+%0A    %0A    private boolean canRunCommand(Command command, User user) %7B%0A        if (command == null) return false;%0A        %0A        if (command.getType().isInternal()) %7B%0A            Guild g = FlareBot.getInstance().getOfficialGuild();%0A            %0A            if (g.getMember(user) != null) %7B%0A                return g.getMember(user).getRoles().contains(g.getRoleById(command.getType().getRoleId()));%0A            %7D else%0A                return false;%0A        %7D else%0A            return true;%0A    %7D
 %0A%0A    @Overr

Implement checking for the certain roles for usage