本文整理汇总了Java中org.pircbotx.hooks.events.PartEvent类的典型用法代码示例。如果您正苦于以下问题:Java PartEvent类的具体用法?Java PartEvent怎么用?Java PartEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PartEvent类属于org.pircbotx.hooks.events包,在下文中一共展示了PartEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPart
import org.pircbotx.hooks.events.PartEvent; //导入依赖的package包/类
@Override
protected void onPart(PartEvent e) {
Bot bot = e.getBot();
IdentService service = bot.manager.getService(IdentService.class);
NickServIdentMethod method = service.getMethod(NickServIdentMethod.class);
if (method == null || !method.isAvailable())
return;
String nick = e.getUser().getNick();
Bot foundBot = bot.manager.bots.filterFirst(bot2 -> {
for (Channel channel : bot2.getUserBot().getChannels()) {
if (channel.getUsersNicks().contains(nick))
return true;
}
return false;
});
if (foundBot == null)
method.onQuit(nick);
}
示例2: onPart
import org.pircbotx.hooks.events.PartEvent; //导入依赖的package包/类
public void onPart(PartEvent event) throws Exception {
IRCUtils.sendRelayMessage(event.getBot(), event.getChannel(), IRCUtils.noPing(event.getUser().getNick()) + " (" + event.getUserHostmask().getLogin() + "@" + event.getUserHostmask().getHostname() +") left " + event.getChannel().getName() + " (" + event.getReason() + ")");
Record rec = DatabaseUtils.getChannelProperty(IRCUtils.getNetworkNameByNetwork(event.getBot()), event.getChannel().getName(), "removerejoin");
if (rec == null)
return;
if (rec.getValue(Channelproperty.CHANNELPROPERTY.VALUE).equalsIgnoreCase("true")) {
if (Registry.lastLeftChannel.get(event.getBot()).equals(event.getChannel().getName())) {
Registry.lastLeftChannel.put(event.getBot(), "");
} else if (event.getUser().getNick().equals(event.getBot().getNick())) {
int tries = 0;
do {
event.getBot().sendIRC().joinChannel(event.getChannel().getName());
tries++;
TimeUnit.SECONDS.sleep(5);
} while (tries < 10 && !event.getBot().getUserBot().getChannels().contains(event.getChannel()));
}
}
if (PermUtils.getPermLevel(event.getBot(), event.getUser().getNick(), event.getChannel()) > -3){
IRCUtils.removeVoice(event.getBot(), event.getChannel(), event.getUser());
}
}
示例3: onPart
import org.pircbotx.hooks.events.PartEvent; //导入依赖的package包/类
@Override
public void onPart(PartEvent<SlyBot> event) throws Exception {
//When the bot leaves a channel
if (event.getUser().equals(event.getBot().getUserBot())) {
System.out.println("Left channel: " + event.getChannel().getName());
Main.getConfig().save("config" + event.getChannel().getName());
Main.getConfig().removeAndDeleteConfiguration("config" + event.getChannel().getName());
}
}
示例4: onPart
import org.pircbotx.hooks.events.PartEvent; //导入依赖的package包/类
@Override
public void onPart(PartEvent event) throws Exception {
super.onPart(event);
if (!event.getUser().getNick().equalsIgnoreCase(bot.getSettings().getTwitchUsername())) {
this.bot.userParted(event.getUser().getNick(), false);
}
}
示例5: onPart
import org.pircbotx.hooks.events.PartEvent; //导入依赖的package包/类
@Override
public void onPart(PartEvent e) {
if (!Config.linkChannels) return;
if (e.getUser().getNick().equals(e.getBot().getNick())) return;
String message = Config.itiPart;
final String reason = (e.getReason().isEmpty()) ? Config.defaultReason : e.getReason();
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}", reason);
plugin.bh.sendMessageToOtherChannels(message, e.getChannel());
}
示例6: onPart
import org.pircbotx.hooks.events.PartEvent; //导入依赖的package包/类
@Override
public void onPart(PartEvent e) {
if (e.getUser().getNick().equals(e.getBot().getNick())) return;
String message = Config.itbPart;
final String reason = (e.getReason().isEmpty()) ? Config.defaultReason : e.getReason();
message = message.replace("{name}", e.getUser().getNick());
message = message.replace("{message}", reason);
message = message.replace("{channel}", e.getChannel().getName());
message = replaceVarsGeneric(e, message);
plugin.sendToMinecraft(message);
}
示例7: onPart
import org.pircbotx.hooks.events.PartEvent; //导入依赖的package包/类
/**
* Occurs when a user parts the game channel.
* @param event part event
*/
@Override
public void onPart(PartEvent<PircBotX> event){
if (event.getChannel().equals(channel)){
processPart(event.getUser());
}
}
示例8: onPart
import org.pircbotx.hooks.events.PartEvent; //导入依赖的package包/类
@Override
public void onPart(final PartEvent<PircBotX> e) {
if (e.getDaoSnapshot().getUsers(e.getChannel()).size() <= 2) e.getChannel().send().part("Alone.");
if (!e.getUser().getNick().equals(rb.getBot().getUserBot().getNick())) return;
List<String> channels = rb.getConfig().getChannels();
if (channels.contains(e.getChannel().getName())) channels.remove(e.getChannel().getName());
rb.getConfig().setChannels(channels);
rb.getLogger().info("Parted from " + e.getChannel().getName() + ".");
}
示例9: createFrom
import org.pircbotx.hooks.events.PartEvent; //导入依赖的package包/类
public static Line createFrom(DatabaseManager manager, PartEvent e) {
return manager.create(Line.class, obj -> {
fillFromGenericChannelUserEvent(obj, e);
obj.type = Type.Part;
});
}
示例10: onPart
import org.pircbotx.hooks.events.PartEvent; //导入依赖的package包/类
@Override
protected void onPart(PartEvent e) {
Line.createFrom(manager.app.databaseManager, e);
}
示例11: onPart
import org.pircbotx.hooks.events.PartEvent; //导入依赖的package包/类
@Override
public void onPart(PartEvent event) throws Exception
{
info(event.getUser().getNick() + " left " + event.getChannel().getName() + ": \"" + event.getReason() + "\"");
}
示例12: onPart
import org.pircbotx.hooks.events.PartEvent; //导入依赖的package包/类
@Override
public void onPart(PartEvent event) {
logger.notice(event.getUser().getNick() + "!" + event.getUser().getLogin() + "@" + event.getUser().getHostmask() + " PARTED " + event.getChannel().getName());
}
示例13: onPart
import org.pircbotx.hooks.events.PartEvent; //导入依赖的package包/类
@Override
public void onPart(PartEvent<PircBotX> event) throws Exception {
IdleBot.botref.penalize(event.getUser(), 250);
super.onPart(event);
}
示例14: onPart
import org.pircbotx.hooks.events.PartEvent; //导入依赖的package包/类
@Override
public void onPart(PartEvent<IdleBot> event) throws Exception {
super.onPart(event);
IdleBot.botref.handleLogout(event.getUser());
}
示例15: onPart
import org.pircbotx.hooks.events.PartEvent; //导入依赖的package包/类
protected void onPart(PartEvent e) { }