diff --git a/pom.xml b/pom.xml index 9402207..928aecf 100644 --- a/pom.xml +++ b/pom.xml @@ -51,8 +51,8 @@ - vault-repo - http://nexus.hc.to/content/repositories/pub_releases + vault-repo + http://nexus.hc.to/content/repositories/pub_releases @@ -199,6 +199,12 @@ VaultAPI 1.6 provided + + + org.bukkit + bukkit + + @@ -360,6 +366,12 @@ us.dynmap dynmap-api 2.5 + + + org.bukkit + bukkit + + @@ -460,7 +472,7 @@ maven-compiler-plugin 3.6.1 - + 1.8 1.8 diff --git a/src/main/java/com/cnaude/purpleirc/Events/IRCMessageEvent.java b/src/main/java/com/cnaude/purpleirc/Events/IRCMessageEvent.java index 283665f..de0b92f 100644 --- a/src/main/java/com/cnaude/purpleirc/Events/IRCMessageEvent.java +++ b/src/main/java/com/cnaude/purpleirc/Events/IRCMessageEvent.java @@ -17,6 +17,7 @@ package com.cnaude.purpleirc.Events; import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; @@ -25,13 +26,14 @@ import org.bukkit.event.HandlerList; * @author Chris Naude Event listener for plugins that want to catch irc message * events from PurpleIRC */ -public class IRCMessageEvent extends Event { +public class IRCMessageEvent extends Event implements Cancellable{ private static final HandlerList HANDLERS = new HandlerList(); private String message; private final String channel; private final String permission; private final Player player; + private boolean cancelled; /** * @@ -117,4 +119,14 @@ public class IRCMessageEvent extends Event { public void setMessage(String message) { this.message = message; } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @Override + public void setCancelled(boolean cancel) { + cancelled = cancel; + } } diff --git a/src/main/java/com/cnaude/purpleirc/PurpleIRC.java b/src/main/java/com/cnaude/purpleirc/PurpleIRC.java index 6f06684..d94e911 100644 --- a/src/main/java/com/cnaude/purpleirc/PurpleIRC.java +++ b/src/main/java/com/cnaude/purpleirc/PurpleIRC.java @@ -1814,11 +1814,17 @@ public class PurpleIRC extends JavaPlugin { } public void broadcastToGame(final String message, final String channel, final String permission) { - getServer().getPluginManager().callEvent(new IRCMessageEvent(message, channel, permission)); + IRCMessageEvent event = new IRCMessageEvent(message, channel, permission); + if (!event.isCancelled()) { + getServer().getPluginManager().callEvent(event); + } } public void broadcastToPlayer(final String message, final String channel, final String permission, final Player player) { - getServer().getPluginManager().callEvent(new IRCMessageEvent(message, channel, permission, player)); + IRCMessageEvent event = new IRCMessageEvent(message, channel, permission, player); + if (!event.isCancelled()) { + getServer().getPluginManager().callEvent(event); + } } /**