当前位置: 首页>>代码示例>>Java>>正文


Java EventListener类代码示例

本文整理汇总了Java中net.dv8tion.jda.core.hooks.EventListener的典型用法代码示例。如果您正苦于以下问题:Java EventListener类的具体用法?Java EventListener怎么用?Java EventListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EventListener类属于net.dv8tion.jda.core.hooks包,在下文中一共展示了EventListener类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadEventListeners

import net.dv8tion.jda.core.hooks.EventListener; //导入依赖的package包/类
private static List<EventListener> loadEventListeners() {
    List<EventListener> eventListeners = new ArrayList<>();

    Logger.info("Loading AutoMod...");
    eventListeners.add(new AutoMod(messageFactory));

    Logger.info("Loading Welcome Manager...");
    eventListeners.add(new WelcomeMessage(messageFactory));

    Logger.info("Loading AutoReact...");
    eventListeners.add(new AutoReact());

    Logger.info("Loading Message Starer...");
    eventListeners.add(new StarMessages());

    return eventListeners;
}
 
开发者ID:WheezyGold7931,项目名称:happybot,代码行数:18,代码来源:Main.java

示例2: addEventListener

import net.dv8tion.jda.core.hooks.EventListener; //导入依赖的package包/类
public void addEventListener(EventListener eventListener) {
    if (eventListener != null) {
        if (this.eventListeners.contains(eventListener)) {
            return;
        }

        this.eventListeners.add(eventListener);

        if (this.jda != null) {
            this.jda.addEventListener(eventListener);
        }
    }
}
 
开发者ID:Chikachi,项目名称:DiscordIntegrationCore,代码行数:14,代码来源:DiscordClient.java

示例3: removeEventListener

import net.dv8tion.jda.core.hooks.EventListener; //导入依赖的package包/类
public void removeEventListener(EventListener eventListener) {
    if (eventListener != null) {
        if (!this.eventListeners.contains(eventListener)) {
            return;
        }

        this.eventListeners.remove(eventListener);

        if (this.jda != null) {
            this.jda.removeEventListener(eventListener);
        }
    }
}
 
开发者ID:Chikachi,项目名称:DiscordIntegrationCore,代码行数:14,代码来源:DiscordClient.java

示例4: initJDA

import net.dv8tion.jda.core.hooks.EventListener; //导入依赖的package包/类
/**
     * Initializes the JDA instance.
     */
    public static void initJDA() {
        if (instance == null)
            throw new NullPointerException("RubiconBot has not been initialized yet.");

        JDABuilder builder = new JDABuilder(AccountType.BOT);
        builder.setToken(instance.configuration.getString("token"));
        builder.setGame(Game.playing("Starting...."));

        // add all EventListeners
        for (EventListener listener : instance.eventListeners)
            builder.addEventListener(listener);

        new ListenerManager(builder);

        try {
            instance.jda = builder.buildBlocking();
        } catch (LoginException | InterruptedException e) {
            Logger.error(e.getMessage());
        }
        CommandVote.loadPolls(instance.jda);
        Info.lastRestart = new Date();
//      CommandGiveaway.startGiveawayManager(instance.jda);

        getJDA().getPresence().setGame(Game.playing("Started."));
        GameAnimator.start();
    }
 
开发者ID:Rubicon-Bot,项目名称:Rubicon,代码行数:30,代码来源:RubiconBot.java

示例5: registerEventListener

import net.dv8tion.jda.core.hooks.EventListener; //导入依赖的package包/类
/**
 * Adds an EventListener to the event pipe. EventListeners registered here will be re-registered when the JDA
 * instance is initialized again.
 *
 * @param listener the EventListener to register.
 * @return false if the bot has never been initialized or if the EventListener is already registered.
 */
public static boolean registerEventListener(EventListener listener) {
    if (instance != null && instance.eventListeners.add(listener)) {
        if (instance.jda != null)
            instance.jda.addEventListener(listener);
        return true;
    }
    return false;
}
 
开发者ID:Rubicon-Bot,项目名称:Rubicon,代码行数:16,代码来源:RubiconBot.java

示例6: register

import net.dv8tion.jda.core.hooks.EventListener; //导入依赖的package包/类
@Override
public void register(Object listener) {
    if(listener instanceof EventListener) {
        listener = new ProxyListener((EventListener)listener);
    }
    eventBus.register(listener);
    listeners.add(listener);
}
 
开发者ID:natanbc,项目名称:GabrielBot,代码行数:9,代码来源:EventManager.java

示例7: listener

import net.dv8tion.jda.core.hooks.EventListener; //导入依赖的package包/类
public static EventListener listener() {
	return LISTENER;
}
 
开发者ID:Mantaro,项目名称:MantaroRPG,代码行数:4,代码来源:InteractiveOperations.java

示例8: main

import net.dv8tion.jda.core.hooks.EventListener; //导入依赖的package包/类
public static void main(String[] args) throws IOException, IllegalArgumentException, LoginException {

        new Logger();

        Logger.info("Initializing the bot...");

        Logger.log("Loading Config Files...");
        createConfigFiles();

        String token = readFirstLineOfFile("config.yml", "There is no token in your config, welcome to stack trace city!");
        theme = readFirstLineOfFile("theme.yml", "Error receiving theme");

        String sqlPassword;
        sqlPassword = readFirstLineOfFile("sql.yml", "Error receiving your SQL Password");

        themeManager = loadThemeManager();
        messageFactory = loadMessageFactory();

        loadTweetMonitor();

        //Load our SQL Stuff
        sqlManager = new SQLManager(sqlPassword);

        Logger.info("Loading Warning Manager...");
        warningManager = new WarningManager(sqlManager);

        Logger.info("Loading Report Manager...");
        reportManager = new ReportManager(sqlManager);

        Logger.info("Loading the Hypixel API...");
        loadHypixelAPI();

        List<EventListener> eventListeners = loadEventListeners();
        loadClientBuilder();

        Logger.info("Constructing the JDA Instance...");
        JDABuilder builder = new JDABuilder(AccountType.BOT)
                .setToken(token)
                .setStatus(OnlineStatus.DO_NOT_DISTURB)
                //Listens to the MessageReceivedEvent.
                .addEventListener(clientBuilder.build())
                .setGame(Game.of(Game.GameType.DEFAULT, "Loading"));
        for (EventListener listener : eventListeners)
            builder.addEventListener(listener);
        jda = builder.buildAsync();

//        new RichPresence((JDAImpl) jda);

        Logger.info("Bot has been loaded!");
    }
 
开发者ID:WheezyGold7931,项目名称:happybot,代码行数:51,代码来源:Main.java

示例9: ProxyListener

import net.dv8tion.jda.core.hooks.EventListener; //导入依赖的package包/类
public ProxyListener(EventListener listener) {
    this.listener = listener;
}
 
开发者ID:natanbc,项目名称:GabrielBot,代码行数:4,代码来源:EventManager.java

示例10: listener

import net.dv8tion.jda.core.hooks.EventListener; //导入依赖的package包/类
public static EventListener listener() {
    return LISTENER;
}
 
开发者ID:natanbc,项目名称:GabrielBot,代码行数:4,代码来源:InteractiveOperations.java

示例11: addExtraListenerToBeAddedAfterStartUp

import net.dv8tion.jda.core.hooks.EventListener; //导入依赖的package包/类
public void addExtraListenerToBeAddedAfterStartUp(EventListener listener) {
    extraListeners.add(listener);
}
 
开发者ID:magnusmickelsson,项目名称:pokeraidbot,代码行数:4,代码来源:BotService.java

示例12: addEventListener

import net.dv8tion.jda.core.hooks.EventListener; //导入依赖的package包/类
public static void addEventListener(final EventListener eventListener) {
    shardManager.addEventListener(eventListener);
}
 
开发者ID:napstr,项目名称:wolfia,代码行数:4,代码来源:Wolfia.java

示例13: removeEventListener

import net.dv8tion.jda.core.hooks.EventListener; //导入依赖的package包/类
public static void removeEventListener(final EventListener eventListener) {
    shardManager.removeEventListener(eventListener);
}
 
开发者ID:napstr,项目名称:wolfia,代码行数:4,代码来源:Wolfia.java


注:本文中的net.dv8tion.jda.core.hooks.EventListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。