diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml
index f024c40..9175d6d 100644
--- a/dependency-reduced-pom.xml
+++ b/dependency-reduced-pom.xml
@@ -219,7 +219,7 @@
com.cnaude.vanishnopacket
VanishNoPacket
- 3.19.1
+ 3.19.2-SNAPSHOT
compile
diff --git a/pom.xml b/pom.xml
index fd2c199..9a1c0f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -181,7 +181,7 @@
com.cnaude.vanishnopacket
VanishNoPacket
- 3.19.1
+ 3.19.2-SNAPSHOT
diff --git a/src/main/java/com/cnaude/purpleirc/GameListeners/VanishNoPacketListener.java b/src/main/java/com/cnaude/purpleirc/GameListeners/VanishNoPacketListener.java
new file mode 100644
index 0000000..fd170ec
--- /dev/null
+++ b/src/main/java/com/cnaude/purpleirc/GameListeners/VanishNoPacketListener.java
@@ -0,0 +1,81 @@
+/*
+ * 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 .
+ */
+package com.cnaude.purpleirc.GameListeners;
+
+import com.cnaude.purpleirc.PurpleBot;
+import com.cnaude.purpleirc.PurpleIRC;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.kitteh.vanish.event.VanishFakeJoinEvent;
+import org.kitteh.vanish.event.VanishFakeQuitEvent;
+
+/**
+ *
+ * @author cnaude
+ */
+public class VanishNoPacketListener implements Listener {
+
+ private final PurpleIRC plugin;
+
+ /**
+ *
+ * @param plugin
+ */
+ public VanishNoPacketListener(PurpleIRC plugin) {
+ this.plugin = plugin;
+ }
+
+ /**
+ *
+ * @param event
+ */
+ @EventHandler(priority = EventPriority.LOWEST)
+ public void onVanishFakeQuitEvent(VanishFakeQuitEvent event) {
+ plugin.logDebug("onVanishFakeQuitEvent: " + event.getPlayer().getName());
+ for (PurpleBot ircBot : plugin.ircBots.values()) {
+ ircBot.gameFakeQuit(event.getPlayer(), event.getQuitMessage());
+ if (plugin.netPackets != null) {
+ plugin.netPackets.updateTabList(event.getPlayer());
+ }
+ }
+ }
+
+ /**
+ *
+ * @param event
+ */
+ @EventHandler(priority = EventPriority.MONITOR)
+ public void onVanishFakeJoinEvent(final VanishFakeJoinEvent event) {
+ plugin.logDebug("onVanishFakeJoinEvent: " + event.getPlayer().getDisplayName()
+ + ": " + event.getPlayer().getCustomName());
+ plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
+ @Override
+ public void run() {
+ plugin.clearHostCache(event.getPlayer());
+ for (PurpleBot ircBot : plugin.ircBots.values()) {
+ ircBot.gameFakeJoin(event.getPlayer(), event.getJoinMessage());
+ if (plugin.netPackets != null) {
+ plugin.netPackets.updateTabList(event.getPlayer());
+ }
+ }
+ plugin.updateDisplayNameCache(event.getPlayer());
+ plugin.updateUuidCache(event.getPlayer());
+ }
+ }, 20);
+ }
+}
diff --git a/src/main/java/com/cnaude/purpleirc/PurpleBot.java b/src/main/java/com/cnaude/purpleirc/PurpleBot.java
index 4f04bbf..347a029 100644
--- a/src/main/java/com/cnaude/purpleirc/PurpleBot.java
+++ b/src/main/java/com/cnaude/purpleirc/PurpleBot.java
@@ -1459,6 +1459,50 @@ public final class PurpleBot {
}
}
}
+
+ /**
+ *
+ * @param player
+ * @param message
+ */
+ public void gameFakeJoin(Player player, String message) {
+ if (!this.isConnected()) {
+ return;
+ }
+ for (String channelName : botChannels) {
+ if (isMessageEnabled(channelName, TemplateName.FAKE_JOIN)) {
+ if (!isPlayerInValidWorld(player, channelName)) {
+ return;
+ }
+ asyncIRCMessage(channelName, plugin.tokenizer
+ .gameChatToIRCTokenizer(player, plugin.getMsgTemplate(
+ botNick, TemplateName.FAKE_JOIN), message));
+ } else {
+ plugin.logDebug("Not sending join message due to " + TemplateName.FAKE_JOIN + " being disabled");
+ }
+ }
+ }
+
+ /**
+ *
+ * @param player
+ * @param message
+ */
+ public void gameFakeQuit(Player player, String message) {
+ if (!this.isConnected()) {
+ return;
+ }
+ for (String channelName : botChannels) {
+ if (isMessageEnabled(channelName, TemplateName.FAKE_QUIT)) {
+ if (!isPlayerInValidWorld(player, channelName)) {
+ return;
+ }
+ asyncIRCMessage(channelName, plugin.tokenizer
+ .gameChatToIRCTokenizer(player, plugin.getMsgTemplate(
+ botNick, TemplateName.FAKE_QUIT), message));
+ }
+ }
+ }
/**
*
diff --git a/src/main/java/com/cnaude/purpleirc/PurpleIRC.java b/src/main/java/com/cnaude/purpleirc/PurpleIRC.java
index 2d8332c..697dd22 100644
--- a/src/main/java/com/cnaude/purpleirc/PurpleIRC.java
+++ b/src/main/java/com/cnaude/purpleirc/PurpleIRC.java
@@ -38,6 +38,7 @@ import com.cnaude.purpleirc.GameListeners.RedditStreamListener;
import com.cnaude.purpleirc.GameListeners.ReportRTSListener;
import com.cnaude.purpleirc.GameListeners.TitanChatListener;
import com.cnaude.purpleirc.GameListeners.TownyChatListener;
+import com.cnaude.purpleirc.GameListeners.VanishNoPacketListener;
import com.cnaude.purpleirc.Hooks.AdminPrivateChatHook;
import com.cnaude.purpleirc.Hooks.DynmapHook;
import com.cnaude.purpleirc.Hooks.FactionChatHook;
@@ -247,7 +248,7 @@ public class PurpleIRC extends JavaPlugin {
getServer().getPluginManager().registerEvents(new GamePlayerJoinListener(this), this);
getServer().getPluginManager().registerEvents(new GamePlayerKickListener(this), this);
getServer().getPluginManager().registerEvents(new GamePlayerQuitListener(this), this);
- getServer().getPluginManager().registerEvents(new GameServerCommandListener(this), this);
+ getServer().getPluginManager().registerEvents(new GameServerCommandListener(this), this);
if (isPluginEnabled("Herochat")) {
logInfo("Enabling HeroChat support.");
getServer().getPluginManager().registerEvents(new HeroChatListener(this), this);
@@ -365,7 +366,13 @@ public class PurpleIRC extends JavaPlugin {
} else {
logInfo("OreBroadcast not detected.");
}
- vanishHook = new VanishHook(this);
+ vanishHook = new VanishHook(this);
+ if (isPluginEnabled("VanishNoPacket")) {
+ logInfo("Enabling VanishNoPacket support.");
+ getServer().getPluginManager().registerEvents(new VanishNoPacketListener(this), this);
+ } else {
+ logInfo("VanishNoPacket not detected.");
+ }
if (isPluginEnabled("SuperVanish")) {
logInfo("Enabling SuperVanish support.");
superVanishHook = new SuperVanishHook(this);
diff --git a/src/main/java/com/cnaude/purpleirc/TemplateName.java b/src/main/java/com/cnaude/purpleirc/TemplateName.java
index 88955de..618b785 100644
--- a/src/main/java/com/cnaude/purpleirc/TemplateName.java
+++ b/src/main/java/com/cnaude/purpleirc/TemplateName.java
@@ -127,5 +127,8 @@ public class TemplateName {
public final static String IRC_A_RESPONSE = "irc-a-response";
public final static String GAME_A_CHAT = "game-a-chat";
+
+ public final static String FAKE_JOIN = "fake-join";
+ public final static String FAKE_QUIT = "fake-quit";
}
diff --git a/src/main/resources/SampleBot.yml b/src/main/resources/SampleBot.yml
index 5b17ba5..896ac81 100644
--- a/src/main/resources/SampleBot.yml
+++ b/src/main/resources/SampleBot.yml
@@ -105,6 +105,8 @@ channels:
- game-kick
- game-join
- game-quit
+ - fake-join
+ - fake-quit
- game-mode
# Essentials helpop messages (/helpop /amsg /ac)
- ess-helpop
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 45f5816..1a651b1 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -92,6 +92,8 @@ message-format:
game-kick: '[&2%WORLD%&r] %MESSAGE%: %REASON%'
game-join: '[&2%WORLD%&r] %NAME% joined the game.'
game-quit: '[&2%WORLD%&r] %NAME% left the game.'
+ fake-join: '[&2%WORLD%&r] %NAME% joined the game.'
+ fake-quit: '[&2%WORLD%&r] %NAME% left the game.'
game-command: '[&2%WORLD%&r] Command detected by %NAME%: %COMMAND% %PARAMS%'
# Message template for "/irc send" to IRC message
game-send: '[&2%WORLD%&r]<%NAME%> %MESSAGE%'
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 1c3cb06..3553099 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -21,6 +21,7 @@ softdepend:
- RedditStream
- AdminPrivateChat
- SuperVanish
+- VanishNoPacket
commands:
irc:
description: Various irc commands