mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-04 14:38:58 +00:00
Fix fetching irc tags
This commit is contained in:
1 parent
20c74891a4
commit
02d6017397
3 files changed
+59
-2
No files matched your search
@@ -89,7 +89,7 @@ public class Channel {
|
|||||||
* @return the permission
|
* @return the permission
|
||||||
*/
|
*/
|
||||||
public String getCraftIRCTag() {
|
public String getCraftIRCTag() {
|
||||||
if (craftIRCTag.isEmpty())
|
if ((craftIRCTag == null) || (craftIRCTag.isEmpty()))
|
||||||
return "admin";
|
return "admin";
|
||||||
|
|
||||||
return craftIRCTag;
|
return craftIRCTag;
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class ConfigurationHandler {
|
|||||||
|
|
||||||
if (rootNode.equalsIgnoreCase("Channels")) {
|
if (rootNode.equalsIgnoreCase("Channels")) {
|
||||||
// Parse the channels
|
// Parse the channels
|
||||||
Map<String, Object> allChannelNodes = (Map<String, Object>) file.get("rootNode");
|
Map<String, Object> allChannelNodes = (Map<String, Object>) file.get(rootNode);
|
||||||
|
|
||||||
// Load channels if the file is NOT empty
|
// Load channels if the file is NOT empty
|
||||||
if (allChannelNodes != null) {
|
if (allChannelNodes != null) {
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package com.palmergames.bukkit.TownyChat.event;
|
||||||
|
|
||||||
|
import org.bukkit.event.CustomEventListener;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
|
import com.herocraftonline.squallseed31.heroicdeath.HeroicDeathEvent;
|
||||||
|
import com.palmergames.bukkit.TownyChat.CraftIRCHandler;
|
||||||
|
import com.palmergames.bukkit.TownyChat.config.ChatSettings;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ElgarL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public class HeroicDeathForwarder extends CustomEventListener implements Listener{
|
||||||
|
|
||||||
|
private CraftIRCHandler ircHandler = null;
|
||||||
|
|
||||||
|
public HeroicDeathForwarder(CraftIRCHandler irc) {
|
||||||
|
this.ircHandler = irc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New style event handler
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
|
public void onHeroicDeathEvent(HeroicDeathEvent event) {
|
||||||
|
|
||||||
|
System.out.print("New event triggered");
|
||||||
|
|
||||||
|
if (ircHandler != null)
|
||||||
|
ircHandler.IRCSender(event.getDeathCertificate().getMessage(), ChatSettings.getHeroicDeathTags());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Old style Event handler
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onCustomEvent(Event event) {
|
||||||
|
|
||||||
|
if (!(event instanceof HeroicDeathEvent)) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (ircHandler != null) {
|
||||||
|
HeroicDeathEvent heroicDeathEvent = (HeroicDeathEvent) event;
|
||||||
|
ircHandler.IRCSender(heroicDeathEvent.getDeathCertificate().getMessage(), ChatSettings.getHeroicDeathTags());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user