TownyChat now passes player chat to Dynmap.

This commit is contained in:
ElgarL committed 2012-01-02 19:10:41 +00:00
1 parent f0955a10ab
commit fa02b75141
5 files changed
+20 -5

No files matched your search

+1
View File
@@ -7,5 +7,6 @@
<classpathentry kind="lib" path="../../lib/Towny.jar"/>
<classpathentry kind="lib" path="E:/ElgarL/lib/Essentials.jar"/>
<classpathentry kind="lib" path="E:/ElgarL/lib/CraftIRC-3.0.0-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="E:/ElgarL/lib/dynmap-api.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
+2 -1
View File
@@ -41,4 +41,5 @@ v0.7:
v0.8:
- Fixed {townformatted} and {nationformatted} to display correctly.
- Updated to use new per world channel formats.
v0.9:
- TownyChat now passes player chat to Dynmap.
@@ -7,6 +7,7 @@ import org.bukkit.event.Event.Priority;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.dynmap.DynmapAPI;
import com.ensifera.animosity.craftirc.CraftIRC;
import com.palmergames.bukkit.TownyChat.CraftIRCHandler;
@@ -30,6 +31,7 @@ public class Chat extends JavaPlugin {
protected PluginManager pm;
private Towny towny = null;
private CraftIRC craftIRC = null;
private DynmapAPI dynMap = null;
private CraftIRCHandler irc = null;
@@ -83,11 +85,16 @@ public class Chat extends JavaPlugin {
logger.warning("Non number format found for craftIRC version string!");
}
}
test = pm.getPlugin("dynmap");
if (test != null) {
dynMap = (DynmapAPI) test;
}
}
public void registerEvents() {
TownyPlayerListener = new TownyPlayerHighestListener(towny, irc);
TownyPlayerListener = new TownyPlayerHighestListener(towny, irc, dynMap);
pm.registerEvent(Event.Type.PLAYER_CHAT, TownyPlayerListener, Priority.Highest, this); //Run this lower so we go before herochat? ( it needs to see us cancel).
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, TownyPlayerListener, Priority.Highest, this);
@@ -6,6 +6,7 @@ import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerListener;
import org.dynmap.DynmapAPI;
import com.earth2me.essentials.User;
import com.palmergames.bukkit.towny.NotRegisteredException;
import com.palmergames.bukkit.towny.Towny;
@@ -23,11 +24,13 @@ import com.palmergames.util.StringMgmt;
public class TownyPlayerHighestListener extends PlayerListener {
private final Towny plugin;
private CraftIRCHandler ircHander;
private final CraftIRCHandler ircHander;
private final DynmapAPI dynMap;
public TownyPlayerHighestListener(Towny instance, CraftIRCHandler irc) {
public TownyPlayerHighestListener(Towny instance, CraftIRCHandler irc, DynmapAPI dynMap) {
this.plugin = instance;
this.ircHander = irc;
this.dynMap = dynMap;
}
@Override
@@ -299,6 +302,9 @@ public class TownyPlayerHighestListener extends PlayerListener {
if (ircHander != null)
ircHander.IRCSender(msg);
if (dynMap != null)
dynMap.postPlayerMessageToWeb(player, event.getMessage());
for (Player test : plugin.getTownyUniverse().getOnlinePlayers()) {
if (!plugin.isPermissions() || (plugin.isPermissions() && TownyUniverse.getPermissionSource().hasPermission(test, TownySettings.getChatChannelPermission(command)))) {
+1 -1
View File
@@ -1,6 +1,6 @@
name: TownyChat
main: com.palmergames.bukkit.TownyChat.Chat
version: 0.8
version: 0.9
author: ElgarL
website: http://code.google.com/a/eclipselabs.org/p/towny/
description: >