mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-02 16:49:56 +01:00
Better fix for HeroChat - still need herochatwebchannel's channel to
be set to join-messages: true to allow web messages before first player message in channel.
This commit is contained in:
parent
06785be5f3
commit
de73cd4028
@ -10,6 +10,7 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.server.PluginEnableEvent;
|
||||
import org.bukkit.event.server.ServerListener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class HeroChatHandler {
|
||||
private static final String DEF_CHANNEL = "Global";
|
||||
@ -18,8 +19,8 @@ public class HeroChatHandler {
|
||||
|
||||
private List<String> hcchannels;
|
||||
private String hcwebinputchannel;
|
||||
private HeroChatChannel hcwebinputchan;
|
||||
private DynmapPlugin plugin;
|
||||
private HeroChatChannel hcwebinputchan;
|
||||
|
||||
private class OurPluginListener extends ServerListener {
|
||||
@Override
|
||||
@ -209,14 +210,12 @@ public class HeroChatHandler {
|
||||
* plugin that may not be present....)
|
||||
*/
|
||||
HeroChatChannel c = ce.getChannel();
|
||||
/* If channel name or nickname matches out web channel, remember it */
|
||||
if((c != null) && (hcwebinputchannel != null) &&
|
||||
((c.getName().equals(hcwebinputchannel)) ||
|
||||
c.getNick().equals(hcwebinputchannel))) {
|
||||
hcwebinputchan = c;
|
||||
}
|
||||
if (ce.isCancelled())
|
||||
return;
|
||||
if((hcwebinputchannel != null) && ((hcwebinputchannel.equals(c.getName())) ||
|
||||
(hcwebinputchannel.equals(c.getNick())))) {
|
||||
hcwebinputchan = c;
|
||||
}
|
||||
if (HeroChatChannelChatEvent.isInstance(event)) {
|
||||
HeroChatChannelChatEvent cce = new HeroChatChannelChatEvent(
|
||||
event);
|
||||
@ -249,9 +248,15 @@ public class HeroChatHandler {
|
||||
/* And get channel to send web messages */
|
||||
hcwebinputchannel = cfg.getNode("web").getString(
|
||||
"herochatwebchannel", DEF_CHANNEL);
|
||||
/* Set up to hear when HeroChat is enabled */
|
||||
server.getPluginManager().registerEvent(Event.Type.PLUGIN_ENABLE,
|
||||
Plugin hc = server.getPluginManager().getPlugin("HeroChat");
|
||||
if(hc != null) {
|
||||
activateHeroChat(hc);
|
||||
}
|
||||
else {
|
||||
/* Set up to hear when HeroChat is enabled */
|
||||
server.getPluginManager().registerEvent(Event.Type.PLUGIN_ENABLE,
|
||||
new OurPluginListener(), Event.Priority.Normal, plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -268,7 +273,6 @@ public class HeroChatHandler {
|
||||
Log.severe("Cannot load HeroChat channel event class!");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Register event handler */
|
||||
plugin.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT,
|
||||
new OurEventListener(), Event.Priority.Monitor, plugin);
|
||||
|
Loading…
Reference in New Issue
Block a user