mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-04 06:28:57 +00:00
Fix a duplicating chat issue when relaying via craftIRC.
This commit is contained in:
1 parent
9c1858320b
commit
6c8f030d49
4 files changed
+36
-11
No files matched your search
@@ -118,3 +118,5 @@ v0.27:
|
|||||||
- Cancel our own event after all other plugins have had a bash at the formatting.
|
- Cancel our own event after all other plugins have had a bash at the formatting.
|
||||||
v0.28:
|
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.
|
||||||
@@ -80,15 +80,20 @@ public class Chat extends JavaPlugin {
|
|||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
unregisterPermissions();
|
unregisterPermissions();
|
||||||
// reset any handles
|
// reset any handles
|
||||||
irc = null;
|
|
||||||
if (craftIRC != null) {
|
if (craftIRC != null) {
|
||||||
craftIRC.unregisterEndPoint("towny");
|
craftIRC.unregisterEndPoint("towny");
|
||||||
craftIRC = null;
|
craftIRC = null;
|
||||||
}
|
}
|
||||||
|
irc = null;
|
||||||
|
|
||||||
dynMap = null;
|
dynMap = null;
|
||||||
heroicDeathListener= null;
|
heroicDeathListener= null;
|
||||||
towny = null;
|
towny = null;
|
||||||
pm = null;
|
pm = null;
|
||||||
|
|
||||||
|
configuration = null;
|
||||||
|
channels = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkPlugins() {
|
private void checkPlugins() {
|
||||||
@@ -105,7 +110,7 @@ public class Chat extends JavaPlugin {
|
|||||||
try {
|
try {
|
||||||
if (Double.valueOf(test.getDescription().getVersion()) >= 3.1) {
|
if (Double.valueOf(test.getDescription().getVersion()) >= 3.1) {
|
||||||
craftIRC = (CraftIRC) test;
|
craftIRC = (CraftIRC) test;
|
||||||
irc = new CraftIRCHandler(towny, craftIRC, "towny");
|
irc = new CraftIRCHandler(craftIRC, "towny");
|
||||||
} else
|
} else
|
||||||
getLogger().warning("TownyChat requires CraftIRC version 3.1 or higher to relay chat.");
|
getLogger().warning("TownyChat requires CraftIRC version 3.1 or higher to relay chat.");
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
@@ -132,12 +137,15 @@ public class Chat extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void registerEvents() {
|
public void registerEvents() {
|
||||||
|
|
||||||
|
if (TownyPlayerListener == null) {
|
||||||
TownyPlayerListener = new TownyChatPlayerListener(this);
|
TownyPlayerListener = new TownyChatPlayerListener(this);
|
||||||
|
|
||||||
if (TownyPlayerListener != null)
|
if (TownyPlayerListener != null)
|
||||||
pm.registerEvents(TownyPlayerListener, this);
|
pm.registerEvents(TownyPlayerListener, this);
|
||||||
if (heroicDeathListener != null)
|
if (heroicDeathListener != null)
|
||||||
pm.registerEvents(heroicDeathListener, this);
|
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
|
* Disable Auto paths and add the following to the 'paths:' section
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
- source: 'minecraft'
|
Set...
|
||||||
target: 'admin'
|
auto-paths: false
|
||||||
formatting:
|
|
||||||
chat: '%message%'
|
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
|
- source: 'admin' # These are endpoint tags
|
||||||
target: 'minecraft' #
|
target: 'minecraft' #
|
||||||
formatting:
|
formatting:
|
||||||
chat: '%foreground%[%red%%ircPrefix%%sender%%foreground%] %message%'
|
chat: '%foreground%[%red%%ircPrefix%%sender%%foreground%] %message%'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
public class CraftIRCHandler extends BasePoint implements CommandEndPoint {
|
public class CraftIRCHandler extends BasePoint implements CommandEndPoint {
|
||||||
|
|
||||||
Towny plugin;
|
Towny plugin;
|
||||||
CraftIRC irc;
|
CraftIRC irc;
|
||||||
|
|
||||||
public CraftIRCHandler(Towny plugin, CraftIRC irc, String tag) {
|
public CraftIRCHandler( CraftIRC irc, String tag) {
|
||||||
this.plugin = plugin;
|
|
||||||
this.irc = irc;
|
this.irc = irc;
|
||||||
// Register this as the tags endpoint
|
// Register this as the tags endpoint
|
||||||
if (irc != null)
|
if (irc != null)
|
||||||
@@ -48,8 +60,10 @@ public class CraftIRCHandler extends BasePoint implements CommandEndPoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void commandIn(RelayedCommand cmd) {
|
public void commandIn(RelayedCommand arg0) {
|
||||||
// Do nothing here as we do not process commands from IRC.
|
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
System.out.print("command");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,4 +83,5 @@ public class CraftIRCHandler extends BasePoint implements CommandEndPoint {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
name: TownyChat
|
name: TownyChat
|
||||||
main: com.palmergames.bukkit.TownyChat.Chat
|
main: com.palmergames.bukkit.TownyChat.Chat
|
||||||
version: 0.28
|
version: 0.29
|
||||||
author: ElgarL, Shade, phrstbrn
|
author: ElgarL, Shade, phrstbrn
|
||||||
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