Merge pull request #22 from TheFlagCourier/TC-Mavenize

Maven Overhaul
This commit is contained in:
LlmDl authored and GitHub committed 2019-09-08 14:07:47 -05:00
commit 8aa1ee1a34
19 files changed
+147 -431

No files matched your search

-17
View File
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre1.8.0_192"/>
<classpathentry kind="lib" path="../lib/Towny.jar">
<attributes>
<attribute name="javadoc_location" value="http://palmergames.com/javadoc/towny-bukkit/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="../lib/Essentials.jar"/>
<classpathentry kind="lib" path="../lib/CraftIRC.jar"/>
<classpathentry kind="lib" path="../lib/dynmap-api.jar"/>
<classpathentry kind="lib" path="../lib/HeroicDeath.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Towny"/>
<classpathentry kind="lib" path="../lib/bukkit.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
-13
View File
@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="TownyChat"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/TownyChat/build.xml}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/TownyChat}"/>
</launchConfiguration>
+14 -2
View File
@@ -1,2 +1,14 @@
/bin/
.idea/
# IDEA Specific
/.idea
*.iml
# Eclipse Specific
.classpath
.project
.externalToolBuilders
# Holdovers from the ol' Ant system
/bin
# Prevent Maven Leakage
/target
-27
View File
@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>TownyChat</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/TownyChat.launch</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
-6
View File
@@ -1,6 +0,0 @@
#===================================
# File Name: build.properties
#===================================
env.LIB=..//lib
evn.DIR=.//src
-50
View File
@@ -1,50 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="TownyChat" default="jar" basedir=".">
<property name="build" value="bin" />
<property file="build.properties" />
<property environment="env"/>
<target name="clean">
<delete dir="${build}" />
</target>
<target name="init" depends="clean">
<mkdir dir="${build}" />
<mkdir dir="${env.LIB}" />
</target>
<target name="download" depends="init">
<get src="http://palmergames.com/file-repo/libs/bukkit.jar" dest="${env.LIB}/bukkit.jar" skipexisting="true" />
<get src="http://palmergames.com/file-repo/libs/Towny.jar" dest="${env.LIB}/Towny.jar" skipexisting="true" />
<get src="http://palmergames.com/file-repo/libs/Essentials.jar" dest="${env.LIB}/Essentials.jar" skipexisting="true" />
<get src="http://palmergames.com/file-repo/libs/CraftIRC.jar" dest="${env.LIB}/CraftIRC.jar" skipexisting="true" />
<get src="http://palmergames.com/file-repo/libs/dynmap-api.jar" dest="${env.LIB}/dynmap-api.jar" skipexisting="true" />
<get src="http://palmergames.com/file-repo/libs/HeroicDeath.jar" dest="${env.LIB}/HeroicDeath.jar" skipexisting="true" />
</target>
<target name="compile" depends="download">
<!-- Compile the java code -->
<javac srcdir="src" destdir="${build}" includeantruntime="false" target="1.8" source="1.8" debug="true">
<classpath>
<pathelement location="${env.LIB}/bukkit.jar" />
<pathelement location="${env.LIB}/Towny.jar" />
<pathelement location="${env.LIB}/Essentials.jar" />
<pathelement location="${env.LIB}/CraftIRC.jar" />
<pathelement location="${env.LIB}/dynmap-api.jar" />
<pathelement location="${env.LIB}/HeroicDeath.jar" />
</classpath>
</javac>
</target>
<target name="jar" depends="compile">
<!-- Build the jar file -->
<jar basedir="${build}" destfile="${env.LIB}/TownyChat.jar">
<fileset dir="./src" includes="changelog.txt" />
<fileset dir="./src" includes="Channels.yml" />
<fileset dir="./src" includes="ChatConfig.yml" />
<fileset dir="./src" includes="plugin.yml" />
</jar>
</target>
</project>
+118
View File
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.palmergames.bukkit</groupId>
<artifactId>TownyChat</artifactId>
<packaging>jar</packaging>
<version>0.57-SNAPSHOT</version>
<licenses>
<license>
<name>CC BY-NC-ND 3.0</name>
<url>http://creativecommons.org/licenses/by-nc-nd/3.0/</url>
<comments>Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported</comments>
</license>
</licenses>
<organization>
<name>TownyAdvanced</name>
<url>https://github.com/TownyAdvanced</url>
</organization>
<properties>
<java.version>1.8</java.version>
<project.bukkitAPIVersion>1.14</project.bukkitAPIVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!-- For use with GitHub Package Registry -->
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub TownyAdvanced Apache Maven Packages</name>
<url>https://maven.pkg.github.com/TownyAdvanced</url>
</repository>
</distributionManagement>
<scm>
<connection>scm:git:https://github.com/TownyAdvanced/TownyChat.git</connection>
<developerConnection>scm:git:https://github.com/TownyAdvanced/TownyChat.git</developerConnection>
<url>https://github.com/TownyAdvanced/TownyChat</url>
</scm>
<repositories>
<!--TODO: Add Repositories for...
- Towny (if not building from local sources)
-->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>ess-repo</id>
<url>https://ci.ender.zone/plugin/repository/everything/</url>
</repository>
<repository>
<id>dynmap-repo</id>
<url>http://repo.mikeprimm.com</url>
</repository>
<repository>
<!--Temporary: Switch to GitHub Packages after beta grant-->
<id>articdive-repo</id>
<url>https://nexus.articdive.de/repository/maven-releases</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.palmergames</groupId>
<artifactId>Towny</artifactId>
<version>0.94.0.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.14.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.ess3</groupId>
<artifactId>EssentialsX</artifactId>
<version>2.17.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>us.dynmap</groupId>
<artifactId>dynmap-api</artifactId>
<version>3.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
@@ -39,7 +39,6 @@ Channels:
messagecolour: '&f'
permission: 'towny.chat.general'
default: true
craftIRCTag: 'admin'
range: '-1'
town:
@@ -48,7 +47,6 @@ Channels:
channeltag: '&f[&3TC&f]'
messagecolour: '&b'
permission: 'towny.chat.town'
craftIRCTag: 'admin'
range: '-1'
nation:
@@ -57,7 +55,6 @@ Channels:
channeltag: '&f[&6NC&f]'
messagecolour: '&e'
permission: 'towny.chat.nation'
craftIRCTag: 'admin'
range: '-1'
admin:
@@ -66,7 +63,6 @@ Channels:
channeltag: '&f[&4ADMIN&f]'
messagecolour: '&c'
permission: 'towny.chat.admin'
craftIRCTag: 'admin'
range: '-1'
mod:
@@ -75,7 +71,6 @@ Channels:
channeltag: '&f[&9MOD&f]'
messagecolour: '&5'
permission: 'towny.chat.mod'
craftIRCTag: 'admin'
range: '-1'
local:
@@ -84,5 +79,4 @@ Channels:
channeltag: '&f[local]'
messagecolour: '&f'
permission: 'towny.chat.local'
craftIRCTag: 'admin'
range: '100'
@@ -236,4 +236,8 @@ v0.54:
v0.55:
- Fix Async chat in Async threads, courtesy of Articdive.
v0.56:
- Upgrade TownyChat to use the new Towny API (0.94.0.2+).
- Upgrade TownyChat to use the new Towny API (0.94.0.2+).
v0.57:
- TownyChat now utilizes the Maven build system.
- EssentialsX Replaces Essentials for API, Dynmap-API is updated for Dynmap v3.
- Removed CraftIRC and HeroicDeath as dependencies.
+2 -2
View File
@@ -1,7 +1,7 @@
name: TownyChat
main: com.palmergames.bukkit.TownyChat.Chat
version: 0.56
api-version: 1.13
version: ${project.version}
api-version: ${project.bukkitAPIVersion}
authors: [ElgarL, Shade, phrstbrn, LlmDl]
website: http://towny.palmergames.com/towny/townychat/
description: >
+4 -45
View File
@@ -1,6 +1,5 @@
package com.palmergames.bukkit.TownyChat;
import com.ensifera.animosity.craftirc.CraftIRC;
import com.palmergames.bukkit.TownyChat.Command.ChannelCommand;
import com.palmergames.bukkit.TownyChat.Command.TownyChatCommand;
import com.palmergames.bukkit.TownyChat.Command.commandobjects.ChannelJoinAliasCommand;
@@ -8,7 +7,6 @@ import com.palmergames.bukkit.TownyChat.channels.Channel;
import com.palmergames.bukkit.TownyChat.channels.ChannelsHolder;
import com.palmergames.bukkit.TownyChat.config.ChatSettings;
import com.palmergames.bukkit.TownyChat.config.ConfigurationHandler;
import com.palmergames.bukkit.TownyChat.listener.HeroicDeathForwarder;
import com.palmergames.bukkit.TownyChat.listener.TownyChatPlayerListener;
import com.palmergames.bukkit.TownyChat.tasks.onLoadedTask;
import com.palmergames.bukkit.TownyChat.util.FileMgmt;
@@ -43,12 +41,8 @@ public class Chat extends JavaPlugin {
protected PluginManager pm;
private Towny towny = null;
private CraftIRC craftIRC = null;
private DynmapAPI dynMap = null;
private CraftIRCHandler irc = null;
private HeroicDeathForwarder heroicDeathListener = null;
boolean chatConfigError = false;
boolean channelsConfigError = false;
@@ -95,15 +89,8 @@ public class Chat extends JavaPlugin {
public void onDisable() {
unregisterPermissions();
// reset any handles
if (craftIRC != null) {
craftIRC.unregisterEndPoint("towny");
craftIRC = null;
}
irc = null;
dynMap = null;
heroicDeathListener= null;
towny = null;
pm = null;
@@ -128,26 +115,7 @@ public class Chat extends JavaPlugin {
test = pm.getPlugin("Towny");
if (test != null && test instanceof Towny)
towny = (Towny) test;
/**
* Hook craftIRC
*/
test = pm.getPlugin("CraftIRC");
if (test != null) {
craftIRC = (CraftIRC) test;
irc = new CraftIRCHandler(this, craftIRC, "towny");
}
/**
* If we found craftIRC check for HeroicDeath
*/
if (irc != null) {
test = pm.getPlugin("HeroicDeath");
if (test != null) {
heroicDeathListener = new HeroicDeathForwarder(irc);
getLogger().info("[TownyChat] Found and attempting to relay Heroic Death messages to craftIRC.");
}
}
test = pm.getPlugin("dynmap");
if (test != null) {
dynMap = (DynmapAPI) test;
@@ -162,8 +130,6 @@ public class Chat extends JavaPlugin {
if (TownyPlayerListener != null)
pm.registerEvents(TownyPlayerListener, this);
if (heroicDeathListener != null)
pm.registerEvents(heroicDeathListener, this);
}
}
@@ -213,18 +179,11 @@ public class Chat extends JavaPlugin {
return towny;
}
public CraftIRCHandler getIRC() {
return irc;
}
public DynmapAPI getDynmap() {
return dynMap;
}
public HeroicDeathForwarder getHeroicDeath() {
return heroicDeathListener;
}
private void registerObjectCommands() {
List<Command> commands = new ArrayList<Command>();
for (Channel channel : channels.getAllChannels().values()) { // All channels
@@ -1,115 +0,0 @@
package com.palmergames.bukkit.TownyChat;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.server.PluginEnableEvent;
import com.ensifera.animosity.craftirc.BasePoint;
import com.ensifera.animosity.craftirc.CommandEndPoint;
import com.ensifera.animosity.craftirc.CraftIRC;
import com.ensifera.animosity.craftirc.RelayedCommand;
import com.ensifera.animosity.craftirc.RelayedMessage;
import com.palmergames.bukkit.towny.Towny;
/**
* @author ElgarL
*
* Add a channel tag of 'admin' to the
* receiving channel in the craftIRC config.
*
* Disable Auto paths and add the following to the 'paths:' section
*/
/*
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: 'minecraft'
target: 'admin'
formatting:
chat: '%message%'
attributes:
chat: false
- source: 'admin' # These are endpoint tags
target: 'minecraft' #
formatting:
chat: '%foreground%[%red%%ircPrefix%%sender%%foreground%] %message%'
*/
public class CraftIRCHandler extends BasePoint implements CommandEndPoint {
Towny towny;
Chat plugin;
CraftIRC irc;
public CraftIRCHandler(Chat plugin, CraftIRC irc, String tag) {
this.irc = irc;
this.plugin = plugin;
// Register this as the tags endpoint
if (irc != null)
irc.registerEndPoint(tag, this);
// Second argument below is the command name
//irc.registerCommand(tag, tag);
// register a Listen for any restarts of craftIRC
plugin.getServer().getPluginManager().registerEvents(new BukkitEvents(), plugin);
}
@Override
public Type getType() {
return Type.MINECRAFT;
}
@Override
public void commandIn(RelayedCommand arg0) {
// TODO Auto-generated method stub
System.out.print("command");
}
/**
* @param message
*/
public void IRCSender(String message, String tags) {
/**
* Relay this to every channel tag listed
*/
String[] tagArray = tags.split(",");
for (String destinationTag : tagArray) {
RelayedMessage msg = irc.newMsgToTag(this, destinationTag.trim(), "chat");
//msg.setField("command", "");
msg.setField("message", message);
msg.post(false);
}
}
protected class BukkitEvents implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void onPluginEnable(PluginEnableEvent event) {
if ((irc != null) && (event.getPlugin().equals(irc)))
plugin.reload();
}
}
}
@@ -12,7 +12,7 @@ public abstract class Channel {
private String name;
private List<String> commands;
private channelTypes type;
private String channelTag, messageColour, permission, leavePermission, craftIRCTag;
private String channelTag, messageColour, permission, leavePermission;
private double range;
private boolean hooked=false;
private boolean autojoin=true;
@@ -93,21 +93,6 @@ public abstract class Channel {
public void setPermission(String permission) {
this.permission = permission;
}
/**
* @return the permission
*/
public String getCraftIRCTag() {
if ((craftIRCTag == null) || (craftIRCTag.isEmpty()))
return "admin";
return craftIRCTag;
}
/**
* @param craftIRCTag the CraftIRC channel Tag to set
*/
public void setCraftIRCTag(String craftIRCTag) {
this.craftIRCTag = craftIRCTag;
}
/**
* @return the range
*/
@@ -2,7 +2,6 @@ package com.palmergames.bukkit.TownyChat.channels;
import com.earth2me.essentials.User;
import com.palmergames.bukkit.TownyChat.Chat;
import com.palmergames.bukkit.TownyChat.CraftIRCHandler;
import com.palmergames.bukkit.TownyChat.TownyChatFormatter;
import com.palmergames.bukkit.TownyChat.config.ChatSettings;
import com.palmergames.bukkit.TownyChat.events.AsyncChatHookEvent;
@@ -143,7 +142,7 @@ public class StandardChannel extends Channel {
/*
* Perform any last channel specific functions
* like logging this chat and relaying to IRC/Dynmap.
* like logging this chat and relaying to Dynmap.
*/
String msg = event.getFormat().replace("%1$s", event.getPlayer().getDisplayName()).replace("%2$s", event.getMessage());
@@ -168,12 +167,7 @@ public class StandardChannel extends Channel {
dynMap.postPlayerMessageToWeb(player, event.getMessage());
break;
}
// Relay to IRC
CraftIRCHandler ircHander = plugin.getIRC();
if (ircHander != null)
ircHander.IRCSender(msg, getCraftIRCTag());
}
/**
@@ -76,18 +76,6 @@ public enum ChatConfigNodes {
"0.5",
"",
"# Spam_time set the minimum time between messages to be flagged as spam"),
HEROIC_DEATH_TO_IRC("HeroicDeathToIRC",
"",
"",
"# If using our updated HeroicDeath.jar and craftIRC 3.1 (dev), you can",
"#configure what IRC channels you want death messages relayed to."),
HEROIC_DEATH_TO_IRC_ENABLED(
"HeroicDeathToIRC.enabled",
"true"),
HEROIC_DEATH_TO_IRC_CRAFTIRCTAGS(
"HeroicDeathToIRC.craftIRCTags",
"admin",
"# comma delimited list of craftIRC channel tags 'admin,blah,blah'."),
CHANNEL_FORMATS(
"channel_formats",
"",
@@ -23,8 +23,6 @@ public class ChatSettings extends tag_formats {
private static boolean per_world;
private static boolean alone_message;
private static String alone_message_string;
private static boolean heroicDeathToIRC = true;
private static String heroicDeathTags ="admin";
private static Map<String, channelFormats> formatGroups = new HashMap<String, channelFormats>();
private static CommentedConfiguration chatConfig, newChatConfig;
@@ -268,38 +266,7 @@ public class ChatSettings extends tag_formats {
public static void setPer_world(boolean per_world) {
ChatSettings.per_world = per_world;
}
/**
* @return the HeroicDeathToIRC
*/
public static boolean isHeroicDeathToIRC() {
return heroicDeathToIRC;
}
/**
* @param HeroicDeathToIRC
* the HeroicDeathToIRC to set
*/
public static void setHeroicDeathToIRC(boolean HeroicDeathToIRC) {
ChatSettings.heroicDeathToIRC = HeroicDeathToIRC;
}
/**
* @return the heroicDeathTags
*/
public static String getHeroicDeathTags() {
return heroicDeathTags;
}
/**
* @param heroicDeathTags
* the heroicDeathTags to set
*/
public static void setheroicDeathTags(String heroicDeathTags) {
ChatSettings.heroicDeathTags = heroicDeathTags;
}
/**
@@ -133,10 +133,6 @@ public class ConfigurationHandler {
if (key.equalsIgnoreCase("leavepermission"))
if (element instanceof String)
channel.setLeavePermission(element.toString());
if (key.equalsIgnoreCase("craftIRCTag"))
if (element instanceof String)
channel.setCraftIRCTag(element.toString());
if (key.equalsIgnoreCase("range"))
channel.setRange(Double.valueOf(element.toString()));
@@ -187,18 +183,6 @@ public class ConfigurationHandler {
if (Key.equalsIgnoreCase("spam_time"))
ChatSettings.setSpam_time( Double.parseDouble((file.get(Key)).toString()) );
if (Key.equalsIgnoreCase("heroicdeathtoirc")) {
Map<String, Object> subNodes = (Map<String, Object>) file.get(Key);
for (String element : subNodes.keySet()) {
if (element.equalsIgnoreCase("enabled"))
ChatSettings.setHeroicDeathToIRC(Boolean.valueOf(subNodes.get(element).toString()));
if (element.equalsIgnoreCase("craftIRCTags"))
ChatSettings.setheroicDeathTags(subNodes.get(element).toString());
}
}
if (Key.equalsIgnoreCase("modify_chat")) {
Map<String, Object> subNodes = (Map<String, Object>) file.get(Key);
@@ -367,10 +351,7 @@ public class ConfigurationHandler {
//
//
// newConfig = newConfig.replace("[spam_time]", (defaults)? "0.5" : Double.toString(ChatSettings.getSpam_time()));
//
// newConfig = newConfig.replace("[hd_enable]", (defaults)? "true" : Boolean.toString(ChatSettings.isHeroicDeathToIRC()));
// newConfig = newConfig.replace("[hd_tags]", (defaults)? "admin" : ChatSettings.getHeroicDeathTags());
//
//
// newConfig = newConfig.replace("[globalformat]", (defaults)? global : ChatSettings.getFormatGroup("channel_formats").getGLOBAL());
// newConfig = newConfig.replace("[townformat]", (defaults)? town : ChatSettings.getFormatGroup("channel_formats").getTOWN());
// newConfig = newConfig.replace("[nationformat]", (defaults)? nation : ChatSettings.getFormatGroup("channel_formats").getNATION());
@@ -23,7 +23,6 @@ import java.util.Set;
* channeltag: '&f[g]'
* messagecolour: '&f'
* permission: 'towny.chat.general'
* craftIRCTag: 'admin'
* range: '-1'
*/
public class AsyncChatHookEvent extends Event {
@@ -1,57 +0,0 @@
package com.palmergames.bukkit.TownyChat.listener;
//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 implements Listener{ // extends CustomEventListener
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) {
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());
}
}
}
*/
}