本文整理汇总了Java中org.pircbotx.hooks.events.ActionEvent类的典型用法代码示例。如果您正苦于以下问题:Java ActionEvent类的具体用法?Java ActionEvent怎么用?Java ActionEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionEvent类属于org.pircbotx.hooks.events包,在下文中一共展示了ActionEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onGenericUserMessage
import org.pircbotx.hooks.events.ActionEvent; //导入依赖的package包/类
@Override
protected void onGenericUserMessage(GenericUserMessageEvent e) {
if (e.getEvent() instanceof ActionEvent)
return;
CommandCall call = new CommandCall(e);
try {
PreparedCommandCall<?, ?> preparedCall = findCommandToCall(e);
if (preparedCall == null)
return;
CommandResult<?> value = preparedCall.call(call);
String output = value.toString();
if (output != null) {
List<String> lines = Arrays.asList(output.split("\\r?\\n|\\r"));
call.respond(e.<Bot>getBot().manager.linebreakIfNeeded(lines, preparedCall.getLineLimit(call)));
}
} catch (CommandParseException ex) {
call.respond(Arrays.asList(new String[] { ex.getMessage() }));
}
}
示例2: onEvent
import org.pircbotx.hooks.events.ActionEvent; //导入依赖的package包/类
@Override
public void onEvent(Event event) throws Exception {
if (event instanceof GenericUserMessageEvent) {
onGenericUserMessage((GenericUserMessageEvent)event);
} else {
if (event instanceof MessageEvent)
onGenericUserMessage(new GenericUserMessageEvent((MessageEvent)event));
else if (event instanceof ActionEvent)
onGenericUserMessage(new GenericUserMessageEvent((ActionEvent)event));
else if (event instanceof PrivateMessageEvent)
onGenericUserMessage(new GenericUserMessageEvent((PrivateMessageEvent)event));
else if (event instanceof NoticeEvent)
onGenericUserMessage(new GenericUserMessageEvent((NoticeEvent)event));
}
if (event instanceof ExtendedJoinEvent)
onExtendedJoin((ExtendedJoinEvent)event);
else if (event instanceof AccountNotifyEvent)
onAccountNotify((AccountNotifyEvent)event);
else if (event instanceof OutActionEvent)
onOutAction((OutActionEvent)event);
else if (event instanceof OutMessageEvent)
onOutMessage((OutMessageEvent)event);
else if (event instanceof OutNoticeEvent)
onOutNotice((OutNoticeEvent)event);
else if (event instanceof OutPrivateMessageEvent)
onOutPrivateMessage((OutPrivateMessageEvent)event);
else if (event instanceof Whois2Event)
onWhois2((Whois2Event)event);
if (event instanceof NoticeEvent) {
NoticeEvent e = (NoticeEvent)event;
if (e.getUser() == null || e.getUser().getServer() == null || e.getUser().getServer().equals("")) {
onServerNotice(new ServerNoticeEvent(e.getBot(), e.getUserHostmask(), e.getUser(), e.getMessage()));
return;
}
}
super.onEvent(event);
}
示例3: createFrom
import org.pircbotx.hooks.events.ActionEvent; //导入依赖的package包/类
public static Line createFrom(DatabaseManager manager, ActionEvent e) {
return manager.create(Line.class, obj -> {
fillFromGenericChannelUserEvent(obj, e);
obj.type = Type.Action;
obj.content = e.getMessage();
});
}
示例4: onAction
import org.pircbotx.hooks.events.ActionEvent; //导入依赖的package包/类
@Override
public void onAction(ActionEvent<PircBotX> event) throws Exception {
String formatted = config.getActionFormatString()
.replace("{user}", jsonEscape(event.getUser().getNick()))
.replace("{message}", jsonEscape(event.getMessage()));
ObfuscationHelper.sendMessageFromJson(formatted);
}
示例5: onAction
import org.pircbotx.hooks.events.ActionEvent; //导入依赖的package包/类
@Override
public void onAction(ActionEvent event) throws Exception
{
if(Lists.isIgnored(event.getUser().getNick()))
{
Logging.warn("Ignoring user " + event.getUser().getNick());
return;
}
LinkManager.handleLink(event.getMessage(), event.getChannel().getName(), event.getUser().getNick());
}
示例6: onAction
import org.pircbotx.hooks.events.ActionEvent; //导入依赖的package包/类
@Override
public void onAction(ActionEvent event) {
if (PermUtils.getPermLevel(event.getBot(), event.getUser().getNick(), event.getChannel()) > -4 && IRCUtils.getPrefix(event.getBot(), event.getChannelSource()).isEmpty())
IRCUtils.sendRelayMessage(event.getBot(), event.getChannel(), "* " + IRCUtils.noPing(event.getUser().getNick()) + " " + event.getMessage());
if (PermUtils.getPermLevel(event.getBot(), event.getUser().getNick(), event.getChannel()) > -3){
IRCUtils.addVoice(event.getBot(), event.getChannel(), event.getUser());
}
}
示例7: onAction
import org.pircbotx.hooks.events.ActionEvent; //导入依赖的package包/类
@Override
public void onAction(ActionEvent event) throws Exception {
class process implements Runnable {
public void run() {
TellMessageTrigger(event.getBot(), event.getUser(), event.getChannel(), IRCUtils.getPrefix(event.getBot(), event.getChannelSource()));
}
}
Registry.threadPool.execute(new process());
}
示例8: onAction
import org.pircbotx.hooks.events.ActionEvent; //导入依赖的package包/类
@Override
public void onAction(ActionEvent e) {
if (!Config.linkChannels) return;
if (e.getUser().getNick().equals(e.getBot().getNick())) return;
String message = Config.itiAction;
message = message.replace("{server}", e.getBot().getConfiguration().getServerHostname());
message = message.replace("{name}", e.getUser().getNick());
message = message.replace("{channel}", e.getChannel().getName());
message = message.replace("{message}", e.getMessage());
plugin.bh.sendMessageToOtherChannels(message, e.getChannel());
}
示例9: onAction
import org.pircbotx.hooks.events.ActionEvent; //导入依赖的package包/类
@Override
public void onAction(ActionEvent e) {
if (e.getUser().getNick().equals(e.getBot().getNick())) return;
String message = Config.itbAction;
message = replaceVars(e, message);
message = message.replace("{channel}", e.getChannel().getName());
message = replaceVarsGeneric(e, message);
plugin.sendToMinecraft(message);
}
示例10: pat
import org.pircbotx.hooks.events.ActionEvent; //导入依赖的package包/类
@Listener
public void pat(final ActionEvent e) {
if (!e.getMessage().trim().matches("pats " + e.getBot().getNick() + "\\.?")) return;
final int chance = this.rb.getConfig().getPatChances(e.getUser().getNick());
if (chance != 100 && chance / 100D <= this.rb.getRandom().nextDouble()) return;
e.getChannel().send().action(this.getAction(e.getUser()));
}
示例11: onAction
import org.pircbotx.hooks.events.ActionEvent; //导入依赖的package包/类
@Override
public void onAction(ActionEvent<AgarBot> event) {
handleBadword(event, event);
}
示例12: GenericUserMessageEvent
import org.pircbotx.hooks.events.ActionEvent; //导入依赖的package包/类
public GenericUserMessageEvent(ActionEvent e) {
super(e.getBot());
event = e;
eMessage = e;
eChannelUser = e;
}
示例13: onAction
import org.pircbotx.hooks.events.ActionEvent; //导入依赖的package包/类
@Override
protected void onAction(ActionEvent e) {
if (e.getChannel() != null)
Line.createFrom(manager.app.databaseManager, e);
}
示例14: onAction
import org.pircbotx.hooks.events.ActionEvent; //导入依赖的package包/类
@Override
public void onAction(ActionEvent event) throws Exception
{
if(event.getAction().startsWith("shrugs"))
Utilities.sendMessage(event.getChannel().getName(), "¯\\_(ツ)_/¯");
}
示例15: onAction
import org.pircbotx.hooks.events.ActionEvent; //导入依赖的package包/类
@Override
public void onAction(ActionEvent event) throws Exception
{
action(event.getChannel().getName(), event.getUser().getNick(), event.getMessage());
}