Added new AwayEvent listener.

This commit is contained in:
cnaude 2015-06-20 22:10:12 -07:00
parent d5a8f53579
commit 4e9fb80944
3 changed files with 58 additions and 1 deletions

View File

@ -97,7 +97,7 @@
<dependency>
<groupId>com.cnaude.pircbotx</groupId>
<artifactId>pircbotx</artifactId>
<version>2.1.5</version>
<version>2.1.6</version>
</dependency>
<!-- Following dependency is provided by CraftBukkit -->

View File

@ -0,0 +1,55 @@
/*
* Copyright (C) 2014 cnaude
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.cnaude.purpleirc.IRCListeners;
import com.cnaude.purpleirc.PurpleBot;
import com.cnaude.purpleirc.PurpleIRC;
import org.pircbotx.User;
import org.pircbotx.hooks.ListenerAdapter;
import org.pircbotx.hooks.events.AwayEvent;
/**
*
* @author cnaude
*/
public class AwayListener extends ListenerAdapter {
PurpleIRC plugin;
PurpleBot ircBot;
/**
*
* @param plugin
* @param ircBot
*/
public AwayListener(PurpleIRC plugin, PurpleBot ircBot) {
this.plugin = plugin;
this.ircBot = ircBot;
}
/**
*
* @param event
*/
@Override
public void onAway(AwayEvent event) {
String awayMessage = event.getAwayMessage();
User user = event.getUser();
plugin.logDebug("[USER:" + user.getNick() + "] [Away:" + awayMessage + "]");
}
}

View File

@ -17,6 +17,7 @@
package com.cnaude.purpleirc;
import com.cnaude.purpleirc.IRCListeners.ActionListener;
import com.cnaude.purpleirc.IRCListeners.AwayListener;
import com.cnaude.purpleirc.IRCListeners.ConnectListener;
import com.cnaude.purpleirc.IRCListeners.DisconnectListener;
import com.cnaude.purpleirc.IRCListeners.JoinListener;
@ -354,6 +355,7 @@ public final class PurpleBot {
private void addListeners() {
ircListeners.add(new ActionListener(plugin, this));
ircListeners.add(new AwayListener(plugin, this));
ircListeners.add(new ConnectListener(plugin, this));
ircListeners.add(new DisconnectListener(plugin, this));
ircListeners.add(new JoinListener(plugin, this));