mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-24 11:15:21 +01:00
added option to disable webchat input
This commit is contained in:
parent
689df03b78
commit
32fdf9da86
1
configuration.txt
Executable file → Normal file
1
configuration.txt
Executable file → Normal file
@ -69,6 +69,7 @@ web:
|
|||||||
|
|
||||||
# showchat: modal/balloons
|
# showchat: modal/balloons
|
||||||
showchat: modal
|
showchat: modal
|
||||||
|
allowchat: true
|
||||||
messagettl: 15000
|
messagettl: 15000
|
||||||
|
|
||||||
showplayerfacesonmap: true
|
showplayerfacesonmap: true
|
||||||
|
@ -132,15 +132,18 @@ public class DynmapPlugin extends JavaPlugin {
|
|||||||
webServer.handlers.put("/up/configuration", new ClientConfigurationHandler((Map<?, ?>) configuration.getProperty("web")));
|
webServer.handlers.put("/up/configuration", new ClientConfigurationHandler((Map<?, ?>) configuration.getProperty("web")));
|
||||||
|
|
||||||
SendMessageHandler messageHandler = new SendMessageHandler();
|
SendMessageHandler messageHandler = new SendMessageHandler();
|
||||||
messageHandler.onMessageReceived.addListener(new Listener<SendMessageHandler.Message>() {
|
boolean allowchat = configuration.getBoolean("allowchat", true);
|
||||||
@Override
|
if (allowchat == true) {
|
||||||
public void triggered(Message t) {
|
messageHandler.onMessageReceived.addListener(new Listener<SendMessageHandler.Message>() {
|
||||||
mapManager.pushUpdate(new Client.WebChatMessage(t.name, t.message));
|
@Override
|
||||||
log.info("[WEB]" + t.name + ": " + t.message);
|
public void triggered(Message t) {
|
||||||
getServer().broadcastMessage("[WEB]" + t.name + ": " + t.message);
|
mapManager.pushUpdate(new Client.WebChatMessage(t.name, t.message));
|
||||||
}
|
log.info("[WEB]" + t.name + ": " + t.message);
|
||||||
});
|
getServer().broadcastMessage("[WEB]" + t.name + ": " + t.message);
|
||||||
webServer.handlers.put("/up/sendmessage", messageHandler);
|
}
|
||||||
|
});
|
||||||
|
webServer.handlers.put("/up/sendmessage", messageHandler);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
webServer.startServer();
|
webServer.startServer();
|
||||||
|
32
web/map.js
32
web/map.js
@ -202,21 +202,23 @@ DynMap.prototype = {
|
|||||||
var messagelist = me.messagelist = $('<div/>')
|
var messagelist = me.messagelist = $('<div/>')
|
||||||
.addClass('messagelist')
|
.addClass('messagelist')
|
||||||
.appendTo(chat);
|
.appendTo(chat);
|
||||||
var chatinput = me.chatinput = $('<input/>')
|
if (me.options.allowchat === 'true') {
|
||||||
.addClass('chatinput')
|
var chatinput = me.chatinput = $('<input/>')
|
||||||
.attr({
|
.addClass('chatinput')
|
||||||
id: 'chatinput',
|
.attr({
|
||||||
type: 'text',
|
id: 'chatinput',
|
||||||
value: ''
|
type: 'text',
|
||||||
})
|
value: ''
|
||||||
.keydown(function(event) {
|
})
|
||||||
if (event.keyCode == '13') {
|
.keydown(function(event) {
|
||||||
event.preventDefault();
|
if (event.keyCode == '13') {
|
||||||
sendChat(chatinput.val());
|
event.preventDefault();
|
||||||
chatinput.val('');
|
sendChat(chatinput.val());
|
||||||
}
|
chatinput.val('');
|
||||||
})
|
}
|
||||||
.appendTo(chat);
|
})
|
||||||
|
.appendTo(chat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Enable hash-links.
|
// TODO: Enable hash-links.
|
||||||
|
Loading…
Reference in New Issue
Block a user