diff --git a/src/main/java/org/dynmap/Client.java b/src/main/java/org/dynmap/Client.java index d27f3e0b..a0a2401b 100644 --- a/src/main/java/org/dynmap/Client.java +++ b/src/main/java/org/dynmap/Client.java @@ -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"; diff --git a/src/main/java/org/dynmap/DynmapPlugin.java b/src/main/java/org/dynmap/DynmapPlugin.java index 1e1295c6..edaf192b 100644 --- a/src/main/java/org/dynmap/DynmapPlugin.java +++ b/src/main/java/org/dynmap/DynmapPlugin.java @@ -98,6 +98,7 @@ public class DynmapPlugin extends JavaPlugin { messageHandler.onMessageReceived.addListener(new Listener() { @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); } diff --git a/web/map.js b/web/map.js index dd46d92e..0ee01f2d 100644 --- a/web/map.js +++ b/web/map.js @@ -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, '!');