mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-26 18:47:40 +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.PluginEnableEvent;
|
||||||
import org.bukkit.event.server.ServerListener;
|
import org.bukkit.event.server.ServerListener;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class HeroChatHandler {
|
public class HeroChatHandler {
|
||||||
private static final String DEF_CHANNEL = "Global";
|
private static final String DEF_CHANNEL = "Global";
|
||||||
@ -18,8 +19,8 @@ public class HeroChatHandler {
|
|||||||
|
|
||||||
private List<String> hcchannels;
|
private List<String> hcchannels;
|
||||||
private String hcwebinputchannel;
|
private String hcwebinputchannel;
|
||||||
private HeroChatChannel hcwebinputchan;
|
|
||||||
private DynmapPlugin plugin;
|
private DynmapPlugin plugin;
|
||||||
|
private HeroChatChannel hcwebinputchan;
|
||||||
|
|
||||||
private class OurPluginListener extends ServerListener {
|
private class OurPluginListener extends ServerListener {
|
||||||
@Override
|
@Override
|
||||||
@ -209,14 +210,12 @@ public class HeroChatHandler {
|
|||||||
* plugin that may not be present....)
|
* plugin that may not be present....)
|
||||||
*/
|
*/
|
||||||
HeroChatChannel c = ce.getChannel();
|
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())
|
if (ce.isCancelled())
|
||||||
return;
|
return;
|
||||||
|
if((hcwebinputchannel != null) && ((hcwebinputchannel.equals(c.getName())) ||
|
||||||
|
(hcwebinputchannel.equals(c.getNick())))) {
|
||||||
|
hcwebinputchan = c;
|
||||||
|
}
|
||||||
if (HeroChatChannelChatEvent.isInstance(event)) {
|
if (HeroChatChannelChatEvent.isInstance(event)) {
|
||||||
HeroChatChannelChatEvent cce = new HeroChatChannelChatEvent(
|
HeroChatChannelChatEvent cce = new HeroChatChannelChatEvent(
|
||||||
event);
|
event);
|
||||||
@ -249,9 +248,15 @@ public class HeroChatHandler {
|
|||||||
/* And get channel to send web messages */
|
/* And get channel to send web messages */
|
||||||
hcwebinputchannel = cfg.getNode("web").getString(
|
hcwebinputchannel = cfg.getNode("web").getString(
|
||||||
"herochatwebchannel", DEF_CHANNEL);
|
"herochatwebchannel", DEF_CHANNEL);
|
||||||
/* Set up to hear when HeroChat is enabled */
|
Plugin hc = server.getPluginManager().getPlugin("HeroChat");
|
||||||
server.getPluginManager().registerEvent(Event.Type.PLUGIN_ENABLE,
|
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);
|
new OurPluginListener(), Event.Priority.Normal, plugin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +273,6 @@ public class HeroChatHandler {
|
|||||||
Log.severe("Cannot load HeroChat channel event class!");
|
Log.severe("Cannot load HeroChat channel event class!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Register event handler */
|
/* Register event handler */
|
||||||
plugin.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT,
|
plugin.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT,
|
||||||
new OurEventListener(), Event.Priority.Monitor, plugin);
|
new OurEventListener(), Event.Priority.Monitor, plugin);
|
||||||
|
Loading…
Reference in New Issue
Block a user