Fix a duplicating chat issue when relaying via craftIRC.

This commit is contained in:
ElgarL committed 2012-04-20 22:24:28 +01:00
1 parent 9c1858320b
commit 6c8f030d49
4 files changed
+46 -21

No files matched your search

+3 -1
View File
@@ -117,4 +117,6 @@ v0.26:
v0.27:
- Cancel our own event after all other plugins have had a bash at the formatting.
v0.28:
- Forget using any fake events and move to setting recipients. We should now be compatible with just about every other chat modifying plugin there is.
- Forget using any fake events and move to setting recipients. We should now be compatible with just about every other chat modifying plugin there is.
v0.29:
- Fix a duplicating chat issue when relaying via craftIRC.
+16 -8
View File
@@ -80,15 +80,20 @@ public class Chat extends JavaPlugin {
public void onDisable() {
unregisterPermissions();
// reset any handles
irc = null;
if (craftIRC != null) {
craftIRC.unregisterEndPoint("towny");
craftIRC = null;
}
irc = null;
dynMap = null;
heroicDeathListener= null;
towny = null;
pm = null;
configuration = null;
channels = null;
}
private void checkPlugins() {
@@ -105,7 +110,7 @@ public class Chat extends JavaPlugin {
try {
if (Double.valueOf(test.getDescription().getVersion()) >= 3.1) {
craftIRC = (CraftIRC) test;
irc = new CraftIRCHandler(towny, craftIRC, "towny");
irc = new CraftIRCHandler(craftIRC, "towny");
} else
getLogger().warning("TownyChat requires CraftIRC version 3.1 or higher to relay chat.");
} catch (NumberFormatException e) {
@@ -132,12 +137,15 @@ public class Chat extends JavaPlugin {
}
public void registerEvents() {
TownyPlayerListener = new TownyChatPlayerListener(this);
if (TownyPlayerListener != null)
pm.registerEvents(TownyPlayerListener, this);
if (heroicDeathListener != null)
pm.registerEvents(heroicDeathListener, this);
if (TownyPlayerListener == null) {
TownyPlayerListener = new TownyChatPlayerListener(this);
if (TownyPlayerListener != null)
pm.registerEvents(TownyPlayerListener, this);
if (heroicDeathListener != null)
pm.registerEvents(heroicDeathListener, this);
}
}
@@ -16,24 +16,36 @@ import com.palmergames.bukkit.towny.Towny;
* Disable Auto paths and add the following to the 'paths:' section
*/
/*
- source: 'minecraft'
target: 'admin'
formatting:
chat: '%message%'
Set...
auto-paths: false
Under channels:
create your channel...
- name: '#YourChannel'
password: ''
#Identifies this channel's endpoint (for the paths: section).
tag: 'admin'
Under paths:
- source: 'admin' # These are endpoint tags
target: 'minecraft' #
formatting:
chat: '%foreground%[%red%%ircPrefix%%sender%%foreground%] %message%'
*/
public class CraftIRCHandler extends BasePoint implements CommandEndPoint {
public class CraftIRCHandler extends BasePoint implements CommandEndPoint {
Towny plugin;
CraftIRC irc;
public CraftIRCHandler(Towny plugin, CraftIRC irc, String tag) {
this.plugin = plugin;
public CraftIRCHandler( CraftIRC irc, String tag) {
this.irc = irc;
// Register this as the tags endpoint
if (irc != null)
@@ -46,10 +58,12 @@ public class CraftIRCHandler extends BasePoint implements CommandEndPoint {
public Type getType() {
return Type.MINECRAFT;
}
@Override
public void commandIn(RelayedCommand cmd) {
// Do nothing here as we do not process commands from IRC.
public void commandIn(RelayedCommand arg0) {
// TODO Auto-generated method stub
System.out.print("command");
}
/**
@@ -69,4 +83,5 @@ public class CraftIRCHandler extends BasePoint implements CommandEndPoint {
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
name: TownyChat
main: com.palmergames.bukkit.TownyChat.Chat
version: 0.28
version: 0.29
author: ElgarL, Shade, phrstbrn
website: http://code.google.com/a/eclipselabs.org/p/towny/
description: >