mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-28 13:15:30 +01:00
Add 'webmsgformat' setting, deprecate 'webprefix' and 'websuffix'
This commit is contained in:
parent
957f6a8dce
commit
8be7e8f68a
@ -18,8 +18,18 @@ public class SimpleWebChatComponent extends Component {
|
|||||||
public void triggered(ChatEvent t) {
|
public void triggered(ChatEvent t) {
|
||||||
DynmapWebChatEvent evt = new DynmapWebChatEvent(t.source, t.name, t.message);
|
DynmapWebChatEvent evt = new DynmapWebChatEvent(t.source, t.name, t.message);
|
||||||
plugin.getServer().getPluginManager().callEvent(evt);
|
plugin.getServer().getPluginManager().callEvent(evt);
|
||||||
if(evt.isCancelled() == false)
|
if(evt.isCancelled() == false) {
|
||||||
plugin.getServer().broadcastMessage(unescapeString(plugin.configuration.getString("webprefix", "\u00A72[WEB] ")) + t.name + ": " + unescapeString(plugin.configuration.getString("websuffix", "\u00A7f")) + t.message);
|
String msg;
|
||||||
|
String msgfmt = plugin.configuration.getString("webmsgformat", null);
|
||||||
|
if(msgfmt != null) {
|
||||||
|
msgfmt = unescapeString(msgfmt);
|
||||||
|
msg = msgfmt.replaceAll("%playername%", t.name).replaceAll("%message%", t.message);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
msg = unescapeString(plugin.configuration.getString("webprefix", "\u00A72[WEB] ")) + t.name + ": " + unescapeString(plugin.configuration.getString("websuffix", "\u00A7f")) + t.message;
|
||||||
|
}
|
||||||
|
plugin.getServer().broadcastMessage(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -28,7 +28,16 @@ public class HeroWebChatComponent extends Component {
|
|||||||
if(evt.isCancelled() == false) {
|
if(evt.isCancelled() == false) {
|
||||||
/* Let HeroChat take a look - only broadcast to players if it doesn't handle it */
|
/* Let HeroChat take a look - only broadcast to players if it doesn't handle it */
|
||||||
if (!handler.sendWebMessageToHeroChat(t.name, t.message)) {
|
if (!handler.sendWebMessageToHeroChat(t.name, t.message)) {
|
||||||
plugin.getServer().broadcastMessage(unescapeString(plugin.configuration.getString("webprefix", "\u00A72[WEB] ")) + t.name + ": " + unescapeString(plugin.configuration.getString("websuffix", "\u00A7f")) + t.message);
|
String msg;
|
||||||
|
String msgfmt = plugin.configuration.getString("webmsgformat", null);
|
||||||
|
if(msgfmt != null) {
|
||||||
|
msgfmt = unescapeString(msgfmt);
|
||||||
|
msg = msgfmt.replaceAll("%playername%", t.name).replaceAll("%message%", t.message);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
msg = unescapeString(plugin.configuration.getString("webprefix", "\u00A72[WEB] ")) + t.name + ": " + unescapeString(plugin.configuration.getString("websuffix", "\u00A7f")) + t.message;
|
||||||
|
}
|
||||||
|
plugin.getServer().broadcastMessage(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -355,9 +355,12 @@ showplayerfacesinmenu: true
|
|||||||
joinmessage: "%playername% joined"
|
joinmessage: "%playername% joined"
|
||||||
quitmessage: "%playername% quit"
|
quitmessage: "%playername% quit"
|
||||||
spammessage: "You may only chat once every %interval% seconds."
|
spammessage: "You may only chat once every %interval% seconds."
|
||||||
# webprefix and websuffix support using '&color;' as escape code for color code
|
# webprefix and websuffix support using '&color;' as escape code for color code (deprecated: use webmsgformat)
|
||||||
webprefix: "&color;2[WEB] "
|
#webprefix: "&color;2[WEB] "
|
||||||
websuffix: "&color;f"
|
#websuffix: "&color;f"
|
||||||
|
# format for messages from web: %playername% substitutes sender ID (typically IP), %message% includes text
|
||||||
|
webmsgformat: "&color;2[WEB] %playername%: &color;f%message%"
|
||||||
|
|
||||||
# Enable checking for banned IPs via banned-ips.txt (internal web server only)
|
# Enable checking for banned IPs via banned-ips.txt (internal web server only)
|
||||||
check-banned-ips: true
|
check-banned-ips: true
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user