package stream.flarebot.flarebot.commands.administrator;

import net.dv8tion.jda.core.Permission;
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.util.MessageUtils;

import java.util.EnumSet;

public class SetPrefixCommand implements Command {
    @Override
    public void onCommand(User sender, TextChannel channel, Message message, String[] args, Member member) {
        if (args.length == 1) {
            if (args[0].equalsIgnoreCase("reset")) {
                FlareBot.getPrefixes().set(channel.getGuild().getId(), '_');
            } else if (args[0].length() == 1) {
                FlareBot.getPrefixes().set(channel.getGuild().getId(), args[0].charAt(0));
            } else {
                channel.sendMessage(MessageUtils.getEmbed(sender)
                        .setDescription("Cannot set the prefix to be more that one character long!")
                        .build()).queue();
                return;
            }
            channel.sendMessage(MessageUtils.getEmbed(sender)
                    .setDescription(String.format("Set the prefix to `%s`", args[0])).build())
                    .queue();
        } else {
            channel.sendMessage(MessageUtils.getEmbed(sender)
                    .setDescription(String.format("Current guild prefix is `%s`!", FlareBot
                            .getPrefix(channel.getGuild().getId()))).build()).queue();
        }
    }

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

    @Override
    public String getDescription() {
        return "Sets the prefix in this guild!";
    }

    @Override
    public String getUsage() {
        return "`{%}prefix [reset]/[prefix]` - Reset or set a prefix for FlareBot commands";
    }

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

    @Override
    public boolean isDefaultPermission() {
        return false;
    }

    @Override
    public EnumSet<Permission> getDiscordPermission() {
        return EnumSet.of(Permission.MANAGE_SERVER);
    }

    @Override
    public String[] getAliases() {
        return new String[]{"setprefix"};
    }
}

@@ -51,16 +51,62 @@
 rator;%0A%0A
+import com.sun.org.apache.regexp.internal.RE;%0A
 import n
@@ -519,16 +519,35 @@
 Utils;%0A%0A
+import java.awt.*;%0A
 import j
@@ -917,132 +917,559 @@
     
-%7D else if (args%5B0%5D.length() == 1) %7B%0A                FlareBot.getPrefixes().set(channel.getGuild().getId(), args%5B0%5D.charAt(0)
+    channel.sendMessage(MessageUtils.getEmbed(sender)%0A                        .setColor(Color.CYAN)%0A                        .setDescription(%22Reset the prefix back to %60_%60!%22).build())%0A                        .queue();%0A            %7D else if (args%5B0%5D.length() == 1) %7B%0A                FlareBot.getPrefixes().set(channel.getGuild().getId(), args%5B0%5D.charAt(0));%0A                channel.sendMessage(MessageUtils.getEmbed(sender)%0A                        .setDescription(String.format(%22Set the prefix to %60%25s%60%22, args%5B0%5D)).build())%0A                        .queue(
 );%0A 
@@ -1655,16 +1655,61 @@
 long!%22)%0A
+                        .setColor(Color.RED)%0A
         
@@ -1785,195 +1785,8 @@
   %7D%0A
-            channel.sendMessage(MessageUtils.getEmbed(sender)%0A                    .setDescription(String.format(%22Set the prefix to %60%25s%60%22, args%5B0%5D)).build())%0A                    .queue();%0A
     

Make better