Skip to content
This repository has been archived by the owner on Jul 27, 2019. It is now read-only.

Commit

Permalink
Enable Essentials AFK listener. (Essentials 2.14 and higher only)
Browse files Browse the repository at this point in the history
  • Loading branch information
cnaude committed May 24, 2014
1 parent b1fd5b8 commit c91cd0b
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 22 deletions.
2 changes: 1 addition & 1 deletion dependency-reduced-pom.xml
Expand Up @@ -145,7 +145,7 @@
<dependency>
<groupId>net.ess3</groupId>
<artifactId>essentials</artifactId>
<version>2.13.121</version>
<version>2.14</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -100,7 +100,7 @@
<dependency>
<groupId>net.ess3</groupId>
<artifactId>essentials</artifactId>
<version>2.13.121</version>
<version>2.14</version>
<type>jar</type>
</dependency>

Expand Down
Expand Up @@ -36,7 +36,7 @@ public void onAfkStatusChangeEvent(AfkStatusChangeEvent event) {
IUser user = event.getAffected();
plugin.logDebug("AFK: " + user.getName() + ":" + user.isAfk());
for (PurpleBot ircBot : plugin.ircBots.values()) {
ircBot.essentialsAFK(user.getBase(), user.isAfk());
ircBot.essentialsAFK(user.getBase(), !user.isAfk());
}
}
}
Expand Up @@ -6,12 +6,10 @@

import com.cnaude.purpleirc.PurpleBot;
import com.cnaude.purpleirc.PurpleIRC;
import java.io.IOException;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.pircbotx.exception.IrcException;

/**
*
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/cnaude/purpleirc/PurpleBot.java
Expand Up @@ -2452,9 +2452,9 @@ public void essentialsAFK(Player player, boolean afk) {
}
String template;
if (afk) {
template = plugin.getMsgTemplate(botNick, TemplateName.PLAYER_AFK);
template = plugin.getMsgTemplate(botNick, TemplateName.ESS_PLAYER_AFK);
} else {
template = plugin.getMsgTemplate(botNick, TemplateName.PLAYER_NOT_AFK);
template = plugin.getMsgTemplate(botNick, TemplateName.ESS_PLAYER_NOT_AFK);
}
plugin.logDebug("Sending AFK message to " + channelName);
asyncIRCMessage(channelName, plugin.tokenizer.gamePlayerAFKTokenizer(player, template));
Expand Down
15 changes: 7 additions & 8 deletions src/main/java/com/cnaude/purpleirc/PurpleIRC.java
Expand Up @@ -3,6 +3,7 @@
import com.cnaude.purpleirc.GameListeners.CleverNotchListener;
import com.cnaude.purpleirc.GameListeners.DeathMessagesListener;
import com.cnaude.purpleirc.GameListeners.DynmapListener;
import com.cnaude.purpleirc.GameListeners.EssentialsListener;
import com.cnaude.purpleirc.GameListeners.GamePlayerChatListener;
import com.cnaude.purpleirc.GameListeners.GamePlayerCommandPreprocessingListener;
import com.cnaude.purpleirc.GameListeners.GamePlayerDeathListener;
Expand Down Expand Up @@ -271,14 +272,12 @@ public void onEnable() {
} else {
logInfo("ReportRTS not detected.");
}
/*
if (isPluginEnabled("Essentials")) {
logInfo("Enabling Essentials support.");
getServer().getPluginManager().registerEvents(new EssentialsListener(this), this);
} else {
logInfo("Essentials not detected.");
}
*/
if (isPluginEnabled("Essentials")) {
logInfo("Enabling Essentials support.");
getServer().getPluginManager().registerEvents(new EssentialsListener(this), this);
} else {
logInfo("Essentials not detected.");
}
commandHandlers = new CommandHandlers(this);
getCommand("irc").setExecutor(commandHandlers);
regexGlobber = new RegexGlobber();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/cnaude/purpleirc/TemplateName.java
Expand Up @@ -69,8 +69,8 @@ public class TemplateName {
public final static String IRC_NOTICE = "irc-notice";
public final static String IRC_CONSOLE_CHAT = "irc-console-chat";

public final static String PLAYER_AFK = "player-afk";
public final static String PLAYER_NOT_AFK = "player-not-afk";
public final static String ESS_PLAYER_AFK = "ess-player-afk";
public final static String ESS_PLAYER_NOT_AFK = "ess-player-not-afk";

public final static String INVALID_IRC_COMMAND = "invalid-irc-command";
public final static String NO_PERM_FOR_IRC_COMMAND = "no-perm-for-irc-command";
Expand Down
6 changes: 1 addition & 5 deletions src/main/java/com/cnaude/purpleirc/Utilities/NetPackets.java
@@ -1,7 +1,3 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.cnaude.purpleirc.Utilities;

import com.cnaude.purpleirc.PurpleBot;
Expand Down Expand Up @@ -87,7 +83,7 @@ public void remFromTabList(String name) {
plugin.logError(e.getMessage());
}
}

/**
*
* @param player
Expand Down

0 comments on commit c91cd0b

Please sign in to comment.