/*
 * Minecraft Dev for IntelliJ
 *
 * https://minecraftdev.org
 *
 * Copyright (c) 2016 Kyle Wood (DemonWav)
 *
 * MIT License
 */

package com.demonwav.mcdev.update;

import com.google.common.collect.ImmutableList;
import com.intellij.openapi.updateSettings.impl.UpdateSettings;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public enum Channels {
    SCOTLIN("Kotlin And Scala Support", "https://plugins.jetbrains.com/plugins/kotlin%20and%20scala%20support/8327", 1),
    MIXINS("Mixins", "https://plugins.jetbrains.com/plugins/mixins/8327", 2),
    EAP("Early Access Program", "https://plugins.jetbrains.com/plugins/early%20access%20program/8327", 3);

    private final String title;
    private final String url;
    private final int index;

    Channels(final String title, final String url, final int index) {
        this.title = title;
        this.url = url;
        this.index = index;
    }

    public String getTitle() {
        return title;
    }

    public String getUrl() {
        return url;
    }

    public int getIndex() {
        return index;
    }

    @Nullable
    public static Channels getChannel(int index) {
        for (Channels channels : values()) {
            if (channels.getIndex() == index) {
                return channels;
            }
        }

        return null;
    }

    public static List<Channels> orderedList() {
        return ImmutableList.of(SCOTLIN, MIXINS, EAP);
    }

    public boolean hasChannel() {
        return UpdateSettings.getInstance().getPluginHosts().contains(url);
    }
}

/*
 * Minecraft Dev for IntelliJ
 *
 * https://minecraftdev.org
 *
 * Copyright (c) 2016 Kyle Wood (DemonWav)
 *
 * MIT License
 */

package com.demonwav.mcdev.update;

import com.google.common.collect.ImmutableList;
import com.intellij.openapi.updateSettings.impl.UpdateSettings;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public enum Channels {
    SCOTLIN("Kotlin And Scala Support", "https://plugins.jetbrains.com/plugins/kotlin%20and%20scala%20support/8327", 1);

    private final String title;
    private final String url;
    private final int index;

    Channels(final String title, final String url, final int index) {
        this.title = title;
        this.url = url;
        this.index = index;
    }

    public String getTitle() {
        return title;
    }

    public String getUrl() {
        return url;
    }

    public int getIndex() {
        return index;
    }

    @Nullable
    public static Channels getChannel(int index) {
        for (Channels channels : values()) {
            if (channels.getIndex() == index) {
                return channels;
            }
        }

        return null;
    }

    public static List<Channels> orderedList() {
        return ImmutableList.of(SCOTLIN);
    }

    public boolean hasChannel() {
        return UpdateSettings.getInstance().getPluginHosts().contains(url);
    }
}

Remove unused channels