mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-06 07:34:43 +02:00
McMMOChatEvent: added a field to hold the dispatching plugin
Currently, there is no sane way to detect which plugin dispatched an McMMOChatEvent. This is problematic for plugins using the ChatAPI while also listening for McMMOChatEvents as it leads to a message loop being created. A "simple" solution is to store a reference to the dispatching plugin in the McMMOChatEvent. This allows for a plugin to determine if it is an event dispatched by itself, or some other plugin. In addition, this can allow for better control within third party plugins to determine where McMMOChatEvents are dispatched from. This patch is backwards with existing interfaces.
This commit is contained in:
@ -1,16 +1,22 @@
|
||||
package com.gmail.nossr50.events.chat;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Called when a chat is sent to a party channel
|
||||
*/
|
||||
public class McMMOPartyChatEvent extends McMMOChatEvent {
|
||||
private String party;
|
||||
|
||||
public McMMOPartyChatEvent(String sender, String party, String message) {
|
||||
super(sender, message);
|
||||
public McMMOPartyChatEvent(Plugin plugin, String sender, String party, String message) {
|
||||
super(plugin, sender, message);
|
||||
this.party = party;
|
||||
}
|
||||
|
||||
public McMMOPartyChatEvent(String sender, String party, String message) {
|
||||
this(null, sender, party, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String name of the party the message will be sent to
|
||||
*/
|
||||
|
Reference in New Issue
Block a user