mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2025-01-23 16:01:29 +01:00
Add IRCMessageEvent
Minor bug fix in mcmmo hook.
This commit is contained in:
parent
07361bc6e8
commit
b27ecc59db
@ -27,7 +27,7 @@ import org.bukkit.event.HandlerList;
|
||||
*/
|
||||
public class IRCCommandEvent extends Event {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private final IRCCommand ircCommand;
|
||||
|
||||
/**
|
||||
@ -52,7 +52,7 @@ public class IRCCommandEvent extends Event {
|
||||
*/
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
return HANDLERS;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,6 +60,6 @@ public class IRCCommandEvent extends Event {
|
||||
* @return
|
||||
*/
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
return HANDLERS;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 2014 cnaude
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.cnaude.purpleirc.Events;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
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 {
|
||||
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private final String message;
|
||||
private final String permission;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param message
|
||||
* @param permission
|
||||
*/
|
||||
public IRCMessageEvent(String message, String permission) {
|
||||
this.message = message;
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getMessage() {
|
||||
return this.message;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getPermission() {
|
||||
return this.permission;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLERS;
|
||||
}
|
||||
}
|
@ -48,7 +48,7 @@ public class McMMOChatHook {
|
||||
plugin.logDebug("[mcMMOChatHook:sendAdminMessage]: " + message);
|
||||
String chatPrefix = Config.getInstance().getAdminChatPrefix();
|
||||
message = LocaleLoader.formatString(chatPrefix, sender) + " " + message;
|
||||
plugin.getServer().broadcast(message, "mcmmo.chat.adminchat");
|
||||
plugin.broadcastToGame(message, "mcmmo.chat.adminchat");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.cnaude.purpleirc;
|
||||
|
||||
import com.cnaude.purpleirc.Events.IRCMessageEvent;
|
||||
import com.cnaude.purpleirc.GameListeners.AdminChatListener;
|
||||
import com.cnaude.purpleirc.GameListeners.CleverNotchListener;
|
||||
import com.cnaude.purpleirc.GameListeners.DeathMessagesListener;
|
||||
@ -1659,6 +1660,7 @@ public class PurpleIRC extends JavaPlugin {
|
||||
}
|
||||
|
||||
public void broadcastToGame(final String message, final String permission) {
|
||||
getServer().getPluginManager().callEvent(new IRCMessageEvent(message, permission));
|
||||
if (broadcastChatToConsole) {
|
||||
logDebug("Broadcast All [" + permission + "]: " + message);
|
||||
getServer().broadcast(message, permission);
|
||||
|
Loading…
Reference in New Issue
Block a user