/*
 * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.dv8tion.jda.api.events.channel;

import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.entities.Channel;
import net.dv8tion.jda.api.entities.ChannelType;
import net.dv8tion.jda.api.events.Event;

import javax.annotation.Nonnull;

//TODO-v5: Docs
public class GenericChannelEvent extends Event
{
    protected final Channel channel;

    public GenericChannelEvent(@Nonnull JDA api, long responseNumber, Channel channel)
    {
        super(api, responseNumber);

        this.channel = channel;
    }

    @Nonnull
    public ChannelType getChannelType()
    {
        return this.channel.getType();
    }

    public boolean isFromType(ChannelType type)
    {
        return getChannelType() == type;
    }

    @Nonnull
    public Channel getChannel()
    {
        return this.channel;
    }

    //TODO-v5: Add getters for all channel types
}

@@ -764,64 +764,9 @@
 ies.
-Channel;%0Aimport net.dv8tion.jda.api.entities.ChannelType
+*
 ;%0Aim
@@ -1119,289 +1119,1550 @@
     
-@Nonnull%0A    public ChannelType getChannelType()%0A    %7B%0A        return this.channel.getType();%0A    %7D%0A%0A    public boolean isFromType(ChannelType type)%0A    %7B%0A        return getChannelType() == type;%0A    %7D%0A%0A    @Nonnull%0A    public Channel getChannel()%0A    %7B%0A        return this.channel
+/**%0A     * Whether this channel event happened in a %7B@link net.dv8tion.jda.api.entities.Guild Guild%7D.%0A     * %3Cbr%3EIf this is %7B@code false%7D then %7B@link #getGuild()%7D will throw an %7B@link java.lang.IllegalStateException%7D.%0A     *%0A     * @return True, if %7B@link #getChannelType()%7D.%7B@link ChannelType#isGuild() isGuild()%7D is true.%0A     */%0A    public boolean isFromGuild()%0A    %7B%0A        return getChannelType().isGuild();%0A    %7D%0A%0A    @Nonnull%0A    public ChannelType getChannelType()%0A    %7B%0A        return this.channel.getType();%0A    %7D%0A%0A    public boolean isFromType(ChannelType type)%0A    %7B%0A        return getChannelType() == type;%0A    %7D%0A%0A    @Nonnull%0A    public Channel getChannel()%0A    %7B%0A        return this.channel;%0A    %7D%0A%0A    /**%0A     * The %7B@link net.dv8tion.jda.api.entities.Guild Guild%7D in which this channel event happened.%0A     * %3Cbr%3EIf this channel event was not received in a %7B@link net.dv8tion.jda.api.entities.TextChannel TextChannel%7D,%0A     * this will throw an %7B@link java.lang.IllegalStateException%7D.%0A     *%0A     * @throws java.lang.IllegalStateException%0A     *         If this channel event did not happen in a %7B@link net.dv8tion.jda.api.entities.GuildChannel%7D.%0A     *%0A     * @return The Guild in which this channel event happened%0A     *%0A     * @see    #isFromType(ChannelType)%0A     * @see    #getChannelType()%0A     */%0A    @Nonnull%0A    public Guild getGuild()%0A    %7B%0A        if (!isFromGuild())%0A            throw new IllegalStateException(%22This channel event did not happen in a guild%22);%0A        return ((GuildChannel) channel).getGuild()
 ;%0A  

Add GenericChannelEvent#isFromGuild and GenericChannelEvent#getGuild (#1935)