Add escape sequence '&color;' support for webprefix/websuffix - avoid frequent editor code page problems.
This commit is contained in:
parent
39a6bee3ca
commit
abd7c25d80
4 changed files with 14 additions and 5 deletions
|
|
@ -10,4 +10,12 @@ public abstract class Component {
|
|||
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
/* Substitute proper values for escape sequences */
|
||||
public static String unescapeString(String v) {
|
||||
/* Replace color code &color; */
|
||||
v = v.replaceAll("&color;", "\u00A7");
|
||||
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class SimpleWebChatComponent extends Component {
|
|||
DynmapWebChatEvent evt = new DynmapWebChatEvent(t.source, t.name, t.message);
|
||||
plugin.getServer().getPluginManager().callEvent(evt);
|
||||
if(evt.isCancelled() == false)
|
||||
plugin.getServer().broadcastMessage(plugin.configuration.getString("webprefix", "\u00A72[WEB] ") + t.name + ": " + plugin.configuration.getString("websuffix", "\u00A7f") + t.message);
|
||||
plugin.getServer().broadcastMessage(unescapeString(plugin.configuration.getString("webprefix", "\u00A72[WEB] ")) + t.name + ": " + unescapeString(plugin.configuration.getString("websuffix", "\u00A7f")) + t.message);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class HeroWebChatComponent extends Component {
|
|||
if(evt.isCancelled() == false) {
|
||||
/* 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(plugin.configuration.getString("webprefix", "\u00A72[WEB] ") + t.name + ": " + plugin.configuration.getString("websuffix", "\u00A7f") + t.message);
|
||||
plugin.getServer().broadcastMessage(unescapeString(plugin.configuration.getString("webprefix", "\u00A72[WEB] ")) + t.name + ": " + unescapeString(plugin.configuration.getString("websuffix", "\u00A7f")) + t.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue