mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-04 14:38:58 +00:00
TownyChat now passes player chat to Dynmap.
This commit is contained in:
1 parent
f0955a10ab
commit
fa02b75141
5 files changed
+20
-5
No files matched your search
@@ -7,5 +7,6 @@
|
|||||||
<classpathentry kind="lib" path="../../lib/Towny.jar"/>
|
<classpathentry kind="lib" path="../../lib/Towny.jar"/>
|
||||||
<classpathentry kind="lib" path="E:/ElgarL/lib/Essentials.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/CraftIRC-3.0.0-SNAPSHOT.jar"/>
|
||||||
|
<classpathentry kind="lib" path="E:/ElgarL/lib/dynmap-api.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
+2
-1
@@ -41,4 +41,5 @@ v0.7:
|
|||||||
v0.8:
|
v0.8:
|
||||||
- Fixed {townformatted} and {nationformatted} to display correctly.
|
- Fixed {townformatted} and {nationformatted} to display correctly.
|
||||||
- Updated to use new per world channel formats.
|
- 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.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.dynmap.DynmapAPI;
|
||||||
|
|
||||||
import com.ensifera.animosity.craftirc.CraftIRC;
|
import com.ensifera.animosity.craftirc.CraftIRC;
|
||||||
import com.palmergames.bukkit.TownyChat.CraftIRCHandler;
|
import com.palmergames.bukkit.TownyChat.CraftIRCHandler;
|
||||||
@@ -30,6 +31,7 @@ public class Chat extends JavaPlugin {
|
|||||||
protected PluginManager pm;
|
protected PluginManager pm;
|
||||||
private Towny towny = null;
|
private Towny towny = null;
|
||||||
private CraftIRC craftIRC = null;
|
private CraftIRC craftIRC = null;
|
||||||
|
private DynmapAPI dynMap = null;
|
||||||
|
|
||||||
private CraftIRCHandler irc = null;
|
private CraftIRCHandler irc = null;
|
||||||
|
|
||||||
@@ -84,10 +86,15 @@ public class Chat extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test = pm.getPlugin("dynmap");
|
||||||
|
if (test != null) {
|
||||||
|
dynMap = (DynmapAPI) test;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerEvents() {
|
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_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);
|
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.PlayerCommandPreprocessEvent;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
import org.bukkit.event.player.PlayerListener;
|
||||||
|
|
||||||
|
import org.dynmap.DynmapAPI;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.palmergames.bukkit.towny.NotRegisteredException;
|
import com.palmergames.bukkit.towny.NotRegisteredException;
|
||||||
import com.palmergames.bukkit.towny.Towny;
|
import com.palmergames.bukkit.towny.Towny;
|
||||||
@@ -23,11 +24,13 @@ import com.palmergames.util.StringMgmt;
|
|||||||
|
|
||||||
public class TownyPlayerHighestListener extends PlayerListener {
|
public class TownyPlayerHighestListener extends PlayerListener {
|
||||||
private final Towny plugin;
|
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.plugin = instance;
|
||||||
this.ircHander = irc;
|
this.ircHander = irc;
|
||||||
|
this.dynMap = dynMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -299,6 +302,9 @@ public class TownyPlayerHighestListener extends PlayerListener {
|
|||||||
if (ircHander != null)
|
if (ircHander != null)
|
||||||
ircHander.IRCSender(msg);
|
ircHander.IRCSender(msg);
|
||||||
|
|
||||||
|
if (dynMap != null)
|
||||||
|
dynMap.postPlayerMessageToWeb(player, event.getMessage());
|
||||||
|
|
||||||
for (Player test : plugin.getTownyUniverse().getOnlinePlayers()) {
|
for (Player test : plugin.getTownyUniverse().getOnlinePlayers()) {
|
||||||
if (!plugin.isPermissions() || (plugin.isPermissions() && TownyUniverse.getPermissionSource().hasPermission(test, TownySettings.getChatChannelPermission(command)))) {
|
if (!plugin.isPermissions() || (plugin.isPermissions() && TownyUniverse.getPermissionSource().hasPermission(test, TownySettings.getChatChannelPermission(command)))) {
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
name: TownyChat
|
name: TownyChat
|
||||||
main: com.palmergames.bukkit.TownyChat.Chat
|
main: com.palmergames.bukkit.TownyChat.Chat
|
||||||
version: 0.8
|
version: 0.9
|
||||||
author: ElgarL
|
author: ElgarL
|
||||||
website: http://code.google.com/a/eclipselabs.org/p/towny/
|
website: http://code.google.com/a/eclipselabs.org/p/towny/
|
||||||
description: >
|
description: >
|
||||||
|
|||||||
Reference in new issue
Block a user