Added WebChat back to web.

This commit is contained in:
FrozenCow 2011-02-19 16:31:13 +01:00
parent c53e6058be
commit 2bd0052aa9
3 changed files with 17 additions and 0 deletions

View File

@ -33,6 +33,17 @@ public class Client {
this.message = message;
}
}
public static class WebChatMessage {
public String type = "webchat";
public String playerName;
public String message;
public WebChatMessage(String playerName, String message) {
this.playerName = playerName;
this.message = message;
}
}
public static class Tile {
public String type = "tile";

View File

@ -98,6 +98,7 @@ public class DynmapPlugin extends JavaPlugin {
messageHandler.onMessageReceived.addListener(new Listener<SendMessageHandler.Message>() {
@Override
public void triggered(Message t) {
mapManager.pushUpdate(new Client.WebChatMessage(t.name, t.message));
log.info("[WEB]" + t.name + ": " + t.message);
getServer().broadcastMessage("[WEB]" + t.name + ": " + t.message);
}

View File

@ -296,6 +296,11 @@ DynMap.prototype = {
if (!me.options.showchat)
return;
me.onPlayerChat(update.playerName, update.message);
},
webchat: function() {
if (!me.options.showchat)
return;
me.onPlayerChat('[WEB] ' + update.playerName, update.message);
}
}, function(type) {
console.log('Unknown type ', value, '!');