diff --git a/pom.xml b/pom.xml
index ee8ec48..c078491 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,8 +17,6 @@
A CraftBukkit plugin for bridging game chat with IRC. Connect to any number of IRC servers and channels simultaneously.
http://dev.bukkit.org/server-mods/purpleirc/
-
-
sonatype-nexus-public
diff --git a/src/main/java/com/cnaude/purpleirc/GameListeners/GamePlayerGameModeChangeListener.java b/src/main/java/com/cnaude/purpleirc/GameListeners/GamePlayerGameModeChangeListener.java
new file mode 100644
index 0000000..e32e2a5
--- /dev/null
+++ b/src/main/java/com/cnaude/purpleirc/GameListeners/GamePlayerGameModeChangeListener.java
@@ -0,0 +1,37 @@
+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.bukkit.event.player.PlayerGameModeChangeEvent;
+
+/**
+ *
+ * @author cnaude
+ */
+public class GamePlayerGameModeChangeListener implements Listener {
+
+ private final PurpleIRC plugin;
+
+ /**
+ *
+ * @param plugin
+ */
+ public GamePlayerGameModeChangeListener(PurpleIRC plugin) {
+ this.plugin = plugin;
+ }
+
+ /**
+ *
+ * @param event
+ */
+ @EventHandler(priority = EventPriority.LOWEST)
+ public void onPlayerGameModeChangeEvent(PlayerGameModeChangeEvent event) {
+ plugin.logDebug("GAMEMODE: " + event.getPlayer().getName() + " => " + event.getNewGameMode());
+ for (PurpleBot ircBot : plugin.ircBots.values()) {
+ ircBot.gameModeChange(event.getPlayer(), event.getNewGameMode());
+ }
+ }
+}
diff --git a/src/main/java/com/cnaude/purpleirc/GameListeners/GamePlayerJoinListener.java b/src/main/java/com/cnaude/purpleirc/GameListeners/GamePlayerJoinListener.java
index 2598c24..015dae7 100644
--- a/src/main/java/com/cnaude/purpleirc/GameListeners/GamePlayerJoinListener.java
+++ b/src/main/java/com/cnaude/purpleirc/GameListeners/GamePlayerJoinListener.java
@@ -1,7 +1,3 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
package com.cnaude.purpleirc.GameListeners;
import com.cnaude.purpleirc.PurpleBot;
diff --git a/src/main/java/com/cnaude/purpleirc/GameListeners/GamePlayerPlayerAchievementAwardedListener.java b/src/main/java/com/cnaude/purpleirc/GameListeners/GamePlayerPlayerAchievementAwardedListener.java
index 307a77f..cbe4141 100644
--- a/src/main/java/com/cnaude/purpleirc/GameListeners/GamePlayerPlayerAchievementAwardedListener.java
+++ b/src/main/java/com/cnaude/purpleirc/GameListeners/GamePlayerPlayerAchievementAwardedListener.java
@@ -1,7 +1,3 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
package com.cnaude.purpleirc.GameListeners;
import com.cnaude.purpleirc.PurpleBot;
diff --git a/src/main/java/com/cnaude/purpleirc/PurpleBot.java b/src/main/java/com/cnaude/purpleirc/PurpleBot.java
index 913ce3d..f9628f8 100644
--- a/src/main/java/com/cnaude/purpleirc/PurpleBot.java
+++ b/src/main/java/com/cnaude/purpleirc/PurpleBot.java
@@ -36,6 +36,7 @@
import java.nio.charset.Charset;
import org.bukkit.Achievement;
import org.bukkit.ChatColor;
+import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
@@ -1288,6 +1289,28 @@ public void gameAchievement(Player player, Achievement achievement) {
}
}
}
+
+ /**
+ *
+ * @param player
+ * @param gameMode
+ */
+ public void gameModeChange(Player player, GameMode gameMode) {
+ if (!this.isConnected()) {
+ return;
+ }
+ String message = gameMode.toString();
+ for (String channelName : botChannels) {
+ if (isMessageEnabled(channelName,TemplateName.GAME_MODE)) {
+ if (!isPlayerInValidWorld(player, channelName)) {
+ return;
+ }
+ asyncIRCMessage(channelName, plugin.tokenizer
+ .gameChatToIRCTokenizer(player, plugin.getMsgTemplate(
+ botNick, TemplateName.GAME_MODE), message));
+ }
+ }
+ }
/**
*
diff --git a/src/main/java/com/cnaude/purpleirc/PurpleIRC.java b/src/main/java/com/cnaude/purpleirc/PurpleIRC.java
index eba5b5f..81e224b 100644
--- a/src/main/java/com/cnaude/purpleirc/PurpleIRC.java
+++ b/src/main/java/com/cnaude/purpleirc/PurpleIRC.java
@@ -7,6 +7,7 @@
import com.cnaude.purpleirc.GameListeners.GamePlayerChatListener;
import com.cnaude.purpleirc.GameListeners.GamePlayerCommandPreprocessingListener;
import com.cnaude.purpleirc.GameListeners.GamePlayerDeathListener;
+import com.cnaude.purpleirc.GameListeners.GamePlayerGameModeChangeListener;
import com.cnaude.purpleirc.GameListeners.GamePlayerJoinListener;
import com.cnaude.purpleirc.GameListeners.GamePlayerKickListener;
import com.cnaude.purpleirc.GameListeners.GamePlayerPlayerAchievementAwardedListener;
@@ -177,6 +178,7 @@ public void onEnable() {
}
}
getServer().getPluginManager().registerEvents(new GamePlayerPlayerAchievementAwardedListener(this), this);
+ getServer().getPluginManager().registerEvents(new GamePlayerGameModeChangeListener(this), this);
getServer().getPluginManager().registerEvents(new GamePlayerChatListener(this), this);
getServer().getPluginManager().registerEvents(new GamePlayerCommandPreprocessingListener(this), this);
getServer().getPluginManager().registerEvents(new GamePlayerDeathListener(this), this);
diff --git a/src/main/java/com/cnaude/purpleirc/TemplateName.java b/src/main/java/com/cnaude/purpleirc/TemplateName.java
index 23e9631..7e3ba5c 100644
--- a/src/main/java/com/cnaude/purpleirc/TemplateName.java
+++ b/src/main/java/com/cnaude/purpleirc/TemplateName.java
@@ -17,6 +17,7 @@ public class TemplateName {
public final static String GAME_QUIT = "game-quit";
public final static String GAME_KICK = "game-kick";
public final static String GAME_COMMAND = "game-command";
+ public final static String GAME_MODE = "game-mode";
public final static String DYNMAP_WEB_CHAT = "dynmap-web-chat";
public final static String IRC_DYNMAP_WEB_CHAT = "irc-dynmap-web-chat";
diff --git a/src/main/resources/SampleBot.yml b/src/main/resources/SampleBot.yml
index 4a1cd99..a6632bd 100644
--- a/src/main/resources/SampleBot.yml
+++ b/src/main/resources/SampleBot.yml
@@ -93,6 +93,7 @@ channels:
- game-kick
- game-join
- game-quit
+ - game-mode
# The game-afk message type is not functional yet.
#- game-afk
# These messages are sent from IRC to game (see permissions)
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 5edc14e..0581267 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -41,42 +41,43 @@ channel-check-interval: 100
# %JOBS% - Player jobs shortened
message-format:
# Message templates for game to IRC messages
- console-chat: '[&5Server] %MESSAGE%'
- game-achievement: '[&2%WORLD%] %NAME% has just earned the achievement [%MESSAGE%]'
- game-action: '[&2%WORLD%] ***%NAME% %MESSAGE%'
- game-pchat: '[&2%WORLD%]<%NAME%> %MESSAGE%'
+ console-chat: '[&dServer&r] %MESSAGE%'
+ game-achievement: '[&2%WORLD%&r] %NAME% has just earned the achievement [%MESSAGE%]'
+ game-mode: '[&2%WORLD%&r] %NAME% has changed game mode: [%MESSAGE%]'
+ game-action: '[&2%WORLD%&r]***%NAME% %MESSAGE%'
+ game-pchat: '[&2%WORLD%] <%NAME%> %MESSAGE%'
# death-messages - http://dev.bukkit.org/bukkit-plugins/death-messages
- death-messages: '[&2%WORLD%] %MESSAGE%'
+ death-messages: '[&2%WORLD%&r]%MESSAGE%'
# Notification to player when sending a private message to an IRC user
game-pchat-response: ' &6-> &7%TARGET%: %MESSAGE%'
- game-chat: '[&2%WORLD%]<%NAME%> %MESSAGE%'
- game-death: '[&2%WORLD%] %MESSAGE%'
- game-kick: '[&2%WORLD%] %MESSAGE%: %REASON%'
- game-join: '[&2%WORLD%] %MESSAGE%'
- game-quit: '[&2%WORLD%] %MESSAGE%'
- game-command: '[&2%WORLD%] Command detected by %NAME%: %COMMAND% %PARAMS%'
+ game-chat: '[&2%WORLD%&r] <%NAME%> %MESSAGE%'
+ game-death: '[&2%WORLD%&r] %MESSAGE%'
+ 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.'
+ game-command: '[&2%WORLD%&r] Command detected by %NAME%: %COMMAND% %PARAMS%'
# Message template for "/irc send" to IRC message
- game-send: '[&2%WORLD%]<%NAME%> %MESSAGE%'
+ game-send: '[&2%WORLD%&r]<%NAME%> %MESSAGE%'
# Essentials messages
- ess-player-afk: '[&2%WORLD%] %NAME% is now AFK'
- ess-player-not-afk: '[&2%WORLD%] %NAME% is no longer AFK'
+ ess-player-afk: '[&2%WORLD%&r] %NAME% is now AFK'
+ ess-player-not-afk: '[&2%WORLD%&r] %NAME% is no longer AFK'
# Message templates for IRC to game messages
- irc-action: '[&4IRC] ***%NAME% %MESSAGE%'
+ irc-action: '[&4IRC&r] ***%NAME% %MESSAGE%'
irc-chat: '[&4IRC]<%NAME%> %MESSAGE%'
irc-pchat: '&dPrivate message: [&4IRC]<%NAME%> %MESSAGE%'
# Notification to user when sending a private message to a player
irc-pchat-response: ' &6-> &7%TARGET%: %MESSAGE%'
# Notification to user when sending a message to a specific hero channel
irc-hchat-response: ' &6-> &7%TARGET%: %MESSAGE%'
- irc-join: '[&4IRC] %NAME% has joined %CHANNEL%.'
- irc-kick: '[&4IRC] %NAME% was kicked from %CHANNEL% by %KICKER%. (Reason- %REASON%)'
- irc-part: '[&4IRC] %NAME% has left %CHANNEL%.'
- irc-quit: '[&4IRC] %NAME% has left %CHANNEL%. (Reason: %REASON%)'
- irc-topic: '[&4IRC] Topic changed by %NAME%: %TOPIC%.'
- irc-nickchange: '[&4IRC] %OLDNICK% is now known as %NEWNICK%.'
- irc-mode: '[&4IRC] %NAME% %MODE% on %CHANNEL%'
+ irc-join: '[&4IRC&r] %NAME% has joined %CHANNEL%.'
+ irc-kick: '[&4IRC&r] %NAME% was kicked from %CHANNEL% by %KICKER%. (Reason- %REASON%)'
+ irc-part: '[&4IRC&r] %NAME% has left %CHANNEL%.'
+ irc-quit: '[&4IRC&r] %NAME% has left %CHANNEL%. (Reason: %REASON%)'
+ irc-topic: '[&4IRC&r] Topic changed by %NAME%: %TOPIC%.'
+ irc-nickchange: '[&4IRC&r] %OLDNICK% is now known as %NEWNICK%.'
+ irc-mode: '[&4IRC&r] %NAME% %MODE% on %CHANNEL%'
irc-console-chat: '&f[&5IRC&f]&r<%NAME%> %MESSAGE%'
- irc-notice: '[&4IRC] [notice(%CHANNEL%)] %NOTICE% '
+ irc-notice: '[&4IRC&r] [notice(%CHANNEL%)] %NOTICE% '
# Message template for Clevernotch bot to IRC messages
clever-send: '[&4BOT]<%NAME%> %MESSAGE%'
# Message templates for mcMMO to IRC messages
@@ -84,20 +85,20 @@ message-format:
mcmmo-party-chat: '[party:%PARTY%]<%NAME%> %MESSAGE%'
mcmmo-chat: '[mcMMO]<%NAME%> %MESSAGE%'
# Message templates for FactionChat to IRC messages
- faction-public-chat: '[%FACTIONMODE%] [%FACTIONTAG%]<%NAME%> %MESSAGE%'
- faction-ally-chat: '[%FACTIONMODE%] [%FACTIONTAG%]<%NAME%> %MESSAGE%'
- faction-enemy-chat: '[%FACTIONMODE%] [%FACTIONTAG%]<%NAME%> %MESSAGE%'
+ faction-public-chat: '[%FACTIONMODE%&r][%FACTIONTAG%]<%NAME%> %MESSAGE%'
+ faction-ally-chat: '[%FACTIONMODE%&r][%FACTIONTAG%]<%NAME%> %MESSAGE%'
+ faction-enemy-chat: '[%FACTIONMODE%&r][%FACTIONTAG%]<%NAME%> %MESSAGE%'
# Message template for Herochat to IRC messages
hero-chat: '[%CHANNEL%]<%NAME%> %MESSAGE%'
- hero-action: '[&2%CHANNEL%] ***%NAME% %MESSAGE%'
+ hero-action: '[&2%CHANNEL%&r]***%NAME% %MESSAGE%'
# Message templates for IRC to Herochat messages
- irc-hero-action: '[&3IRC] ***%NAME% %MESSAGE%'
+ irc-hero-action: '[&3IRC&r] ***%NAME% %MESSAGE%'
irc-hero-chat: '[&3IRC]<%NAME%> %MESSAGE%'
- irc-hero-join: '[&3IRC] %NAME% has joined %CHANNEL%.'
- irc-hero-kick: '[&3IRC] %NAME% was kicked from %CHANNEL% by %KICKER%. (Reason- %REASON%)'
- irc-hero-part: '[&3IRC] %NAME% has left %CHANNEL%.'
- irc-hero-quit: '[&3IRC] %NAME% has left %CHANNEL%.'
- irc-hero-topic: '[&3IRC] Topic changed by %NAME%: %TOPIC%.'
+ irc-hero-join: '[&3IRC&r] %NAME% has joined %CHANNEL%.'
+ irc-hero-kick: '[&3IRC&r] %NAME% was kicked from %CHANNEL% by %KICKER%. (Reason- %REASON%)'
+ irc-hero-part: '[&3IRC&r] %NAME% has left %CHANNEL%.'
+ irc-hero-quit: '[&3IRC&r] %NAME% has left %CHANNEL%.'
+ irc-hero-topic: '[&3IRC&r] Topic changed by %NAME%: %TOPIC%.'
# Message template for TitanChat to IRC messages
titan-chat: '[%CHANNEL%]<%NAME%> %MESSAGE%'
# Message templates for IRC to TitanChat messages
@@ -128,11 +129,11 @@ message-format:
Global: '[%CHANNEL%]<%NAME%> %MESSAGE%'
# Emote message format per hero channel. From game to IRC. Overrides hero-action template.
hero-action-channels:
- Global: '[&2%CHANNEL%] ***%NAME% %MESSAGE%'
+ Global: '[&2%CHANNEL%&r]***%NAME% %MESSAGE%'
# Message templates for Towny to IRC messages
towny-channel-chat: '%TOWNYCHANNELTAG%[%TOWNYCHANNEL%]<%NAME%> %MESSAGE%'
# Message templates for IRC to Towny messages
- irc-towny-chat: '[&3IRC]<%NAME%> %MESSAGE%'
+ irc-towny-chat: '[&3IRC&r]<%NAME%> %MESSAGE%'
# Message format per towny channel. From IRC to game.
irc-towny-channels:
irc: '[IRC]%PLAYERPREFIX%%NAME% %MESSAGE%'
@@ -146,7 +147,7 @@ message-format:
default-player-world: 'world'
default-player-group: ''
# Format for the @list command in IRC
-list-format: '[&9Minecraft] Online (%COUNT%/%MAX%): %PLAYERS%'
+list-format: '[&9Minecraft&r] &2Online &r(%COUNT%/%MAX%): %PLAYERS%'
list-separator: ', '
list-player: '%GROUPPREFIX%%NAME%'
# Sort playerlist by %NAME% and not by list-player format
@@ -160,7 +161,7 @@ strip-irc-bg-colors: true
# Add IRC names to in-game tab list
custom-tab-list: false
# Nothing to see here
-custom-tab-prefix: '[IRC] '
+custom-tab-prefix: '[I] '
# IRC nick must be an exact match to a player name for token expanding
nick-exact-match: true
# IRC nick prefixes (can include & color codes)