• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java UnknownEvent类的典型用法和代码示例

java 2次浏览

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

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

示例1: handleUnknownEvent

点赞 2

import org.pircbotx.hooks.events.UnknownEvent; //导入依赖的package包/类
void handleUnknownEvent(@SuppressWarnings("rawtypes") UnknownEvent event) {
  synchronized (this) {
    if (pingMessage == null) {
      return;
    }

    log.debug(event.getLine());

    boolean contains = event.getLine().contains(" PONG ");
    boolean endsWith = event.getLine().endsWith(pingMessage);
    if (contains && endsWith) {
      pingLatch.countDown();
    }
  }
}
 

开发者ID:OsuCelebrity,
项目名称:OsuCelebrity,
代码行数:16,
代码来源:Pinger.java

示例2: handleLine

点赞 2

import org.pircbotx.hooks.events.UnknownEvent; //导入依赖的package包/类
@Override
public void handleLine(String rawLine) throws IOException, IrcException {
    if (rawLine == null) {
        throw new NullPointerException("rawLine");
    } else {
        String line = CharMatcher.WHITESPACE.trimFrom(rawLine);
        com.google.common.collect.ImmutableMap.Builder<String, String> tags = ImmutableMap.builder();
        String command;
        if (line.startsWith("@")) {
            String parsedLine = line.substring(1, line.indexOf(" "));
            line = line.substring(line.indexOf(" ") + 1);
            StringTokenizer sourceRaw = new StringTokenizer(parsedLine);

            while (sourceRaw.hasMoreTokens()) {
                command = sourceRaw.nextToken(";");
                if (command.contains("=")) {
                    String[] target = command.split("=");
                    tags.put(target[0], target.length == 2 ? target[1] : "");
                } else {
                    tags.put(command, "");
                }
            }
        }

        List<String> parsedLine1 = Utils.tokenizeLine(line);
        String sourceRaw1 = "";
        if (parsedLine1.get(0).charAt(0) == 58) {
            sourceRaw1 = parsedLine1.remove(0);
        }

        command = parsedLine1.remove(0).toUpperCase(this.configuration.getLocale());
        if (!command.equals("PING")) {
            App.logger.info(rawLine);
        }
        if (command.equals("PING")) {
            this.configuration.getListenerManager().onEvent(new ServerPingEvent(this.bot, parsedLine1.get(0)));
        } else if (command.startsWith("ERROR")) {
            this.bot.close();
        } else {
            String target1 = parsedLine1.isEmpty() ? "" : parsedLine1.get(0);
            if (target1.startsWith(":")) {
                target1 = target1.substring(1);
            }

            if (sourceRaw1.startsWith(":")) {
                if (((IRCBot) this.bot).notLoggedIn()) {
                    this.processConnect(line, command, target1, parsedLine1);
                }

                int code1 = Utils.tryParseInt(command, -1);
                if (code1 != -1) {
                    this.processServerResponse(code1, line, parsedLine1);
                } else {
                    UserHostmask source1 = this.bot.getConfiguration().getBotFactory().createUserHostmask(this.bot, sourceRaw1.substring(1));
                    this.processCommand(target1, source1, command, line, parsedLine1, tags.build());
                }
            } else {
                this.configuration.getListenerManager().onEvent(new UnknownEvent(this.bot, line));
                if (((IRCBot) this.bot).notLoggedIn()) {
                    for (CapHandler source : this.configuration.getCapHandlers()) {
                        if (source.handleUnknown(this.bot, line)) {
                            this.addCapHandlerFinished(source);
                        }
                    }
                }

            }
        }
    }
}
 

开发者ID:OTBProject,
项目名称:OTBProject,
代码行数:71,
代码来源:InputParserImproved.java

示例3: onUnknown

点赞 2

import org.pircbotx.hooks.events.UnknownEvent; //导入依赖的package包/类
@Override
public void onUnknown(UnknownEvent<PircBotX> event) throws Exception {
  pinger.handleUnknownEvent(event);
}
 

开发者ID:OsuCelebrity,
项目名称:OsuCelebrity,
代码行数:5,
代码来源:OsuIrcBot.java

示例4: onUnknown

点赞 1

import org.pircbotx.hooks.events.UnknownEvent; //导入依赖的package包/类
@Override
public void onUnknown(UnknownEvent e) throws Exception {

    System.out.println("WARNING! Received the following unknown line from the IRC server: " + e.getLine());
    e.getBot().sendIRC().message(consoleChannel, "Warning! Received the following unknown line from the IRC server: " + e.getLine());

}
 

开发者ID:Walkersneps,
项目名称:SnepsBotX,
代码行数:8,
代码来源:OnUnknown.java

示例5: onUnknown

点赞 1

import org.pircbotx.hooks.events.UnknownEvent; //导入依赖的package包/类
protected void onUnknown(UnknownEvent e) { } 

开发者ID:Shockah,
项目名称:Skylark,
代码行数:2,
代码来源:ListenerPlugin.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)