package me.mrkirby153.KirBot.utils;

import net.dv8tion.jda.core.JDA;
import net.dv8tion.jda.core.entities.Guild;

/**
 * A guild that the robot is a part of
 */
public class DiscordGuild {

    private final String guildId;
    private String commandPrefix = "!";

    private transient Guild guild;
    private transient JDA jda;

    public DiscordGuild(String guildId) {
        this.guildId = guildId;
    }

    @Override
    public boolean equals(Object obj) {
        return obj instanceof DiscordGuild && ((DiscordGuild) obj).guildId.equals(guildId);
    }

    public String getCommandPrefix() {
        return commandPrefix;
    }

    public void setCommandPrefix(String commandPrefix) {
        this.commandPrefix = commandPrefix;
    }

    public String getId() {
        return guildId;
    }

    /**
     * Sets the {@link Guild JDA Guild} that this represents
     *
     * @param guild The guild to set
     */
    public void setGuild(Guild guild) {
        this.guild = guild;
    }

    /**
     * Sets the {@link JDA} instance
     *
     * @param jda The JDA instance
     */
    public void setJDA(JDA jda) {
        this.jda = jda;
    }
}

@@ -95,22 +95,107 @@
 ore.
-entities.Guild
+Permission;%0Aimport net.dv8tion.jda.core.entities.Guild;%0Aimport net.dv8tion.jda.core.entities.Member
 ;%0A%0A/
@@ -837,26 +837,116 @@
     
-public String getI
+/**%0A     * Gets the %7B@link Guild JDA Guild%7D%0A     *%0A     * @return The guild%0A     */%0A    public Guild getGuil
 d() 
@@ -962,23 +962,26 @@
  return 
+this.
 guild
-Id
 ;%0A    %7D%0A
@@ -1138,24 +1138,24 @@
 ld guild) %7B%0A
-
         this
@@ -1169,32 +1169,869 @@
 = guild;%0A    %7D%0A%0A
+    public String getId() %7B%0A        return guildId;%0A    %7D%0A%0A    /**%0A     * Checks if the bot has the given permission on this guild%0A     *%0A     * @param p The permission to check%0A     * @return True if the robot has the given permission on the guild%0A     */%0A    public boolean hasPermission(Permission p) %7B%0A        Member self = guild.getMember(jda.getSelfUser());%0A        return self.hasPermission(p);%0A    %7D%0A%0A    /**%0A     * Checks if the bot has all the given permissions on this guild%0A     *%0A     * @param permissions The permissions to check%0A     * @return True if the robot has all the given permissions on the guild%0A     */%0A    public boolean hasPermissions(Permission... permissions) %7B%0A        for (Permission p : permissions) %7B%0A            if (!hasPermission(p))%0A                return false;%0A        %7D%0A        return true;%0A    %7D%0A%0A
     /**%0A     * S

Add permission checking to guild