Moved HeroChat code to HeroWebChatModule.
This commit is contained in:
parent
b2cb15b75c
commit
987e6bcb54
7 changed files with 83 additions and 35 deletions
25
src/main/java/org/dynmap/herochat/HeroWebChatComponent.java
Normal file
25
src/main/java/org/dynmap/herochat/HeroWebChatComponent.java
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package org.dynmap.herochat;
|
||||
|
||||
import org.dynmap.ChatEvent;
|
||||
import org.dynmap.Component;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapPlugin;
|
||||
import org.dynmap.Event;
|
||||
|
||||
public class HeroWebChatComponent extends Component {
|
||||
HeroChatHandler handler;
|
||||
public HeroWebChatComponent(final DynmapPlugin plugin, ConfigurationNode configuration) {
|
||||
super(plugin, configuration);
|
||||
handler = new HeroChatHandler(configuration, plugin, plugin.getServer());
|
||||
plugin.events.addListener("webchat", new Event.Listener<ChatEvent>() {
|
||||
@Override
|
||||
public void triggered(ChatEvent t) {
|
||||
/* Let HeroChat take a look - only broadcast to players if it doesn't handle it */
|
||||
if (!handler.sendWebMessageToHeroChat(t.name, t.message)) {
|
||||
plugin.getServer().broadcastMessage("[WEB]" + t.name + ": " + t.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue