More options

This commit is contained in:
Draycia committed 2020-06-26 03:47:56 -07:00
1 parent 1959148fb4
commit 95cfa7db52
6 files changed
+35 -14

No files matched your search

@@ -51,8 +51,11 @@ public class AllianceChatChannel extends SimpleChatChannel {
Component component = LegacyComponentSerializer.legacy('&').deserialize(messageFormat);
messageFormat = MiniMessageSerializer.serialize(component);
// Continue parsing the format
messageFormat = MiniMessageParser.handlePlaceholders(messageFormat, "color", "<" + getColor().toString() + ">");
// First pass for placeholders, to support placeholders in placeholders
messageFormat = MiniMessageParser.handlePlaceholders(messageFormat, "color", "<" + getColor().toString() + ">",
"phase", Long.toString(System.currentTimeMillis() % 25), "server", getSimpleChat().getConfig().getString("server-name", "Server"));
// Finally, parse remaining placeholders and parse format
messageFormat = MiniMessageParser.handlePlaceholders(messageFormat, "message", event.getMessage());
Component formattedMessage = MiniMessageParser.parseFormat(messageFormat);
@@ -52,8 +52,11 @@ public class NationChatChannel extends SimpleChatChannel {
Component component = LegacyComponentSerializer.legacy('&').deserialize(messageFormat);
messageFormat = MiniMessageSerializer.serialize(component);
// Continue parsing the format
messageFormat = MiniMessageParser.handlePlaceholders(messageFormat, "color", "<" + getColor().toString() + ">");
// First pass for placeholders, to support placeholders in placeholders
messageFormat = MiniMessageParser.handlePlaceholders(messageFormat, "color", "<" + getColor().toString() + ">",
"phase", Long.toString(System.currentTimeMillis() % 25), "server", getSimpleChat().getConfig().getString("server-name", "Server"));
// Finally, parse remaining placeholders and parse format
messageFormat = MiniMessageParser.handlePlaceholders(messageFormat, "message", event.getMessage());
Component formattedMessage = MiniMessageParser.parseFormat(messageFormat);
@@ -49,8 +49,11 @@ public class PartyChatChannel extends SimpleChatChannel {
Component component = LegacyComponentSerializer.legacy('&').deserialize(messageFormat);
messageFormat = MiniMessageSerializer.serialize(component);
// Continue parsing the format
messageFormat = MiniMessageParser.handlePlaceholders(messageFormat, "color", "<" + getColor().toString() + ">");
// First pass for placeholders, to support placeholders in placeholders
messageFormat = MiniMessageParser.handlePlaceholders(messageFormat, "color", "<" + getColor().toString() + ">",
"phase", Long.toString(System.currentTimeMillis() % 25), "server", getSimpleChat().getConfig().getString("server-name", "Server"));
// Finally, parse remaining placeholders and parse format
messageFormat = MiniMessageParser.handlePlaceholders(messageFormat, "message", event.getMessage());
Component formattedMessage = MiniMessageParser.parseFormat(messageFormat);
@@ -144,8 +144,11 @@ public class SimpleChatChannel extends ChatChannel {
Component component = LegacyComponentSerializer.legacy('&').deserialize(messageFormat);
messageFormat = MiniMessageSerializer.serialize(component);
// Continue parsing the format
messageFormat = MiniMessageParser.handlePlaceholders(messageFormat, "color", "<" + color.toString() + ">", "phase", Long.toString(System.currentTimeMillis() % 25));
// First pass for placeholders, to support placeholders in placeholders
messageFormat = MiniMessageParser.handlePlaceholders(messageFormat, "color", "<" + color.toString() + ">",
"phase", Long.toString(System.currentTimeMillis() % 25), "server", simpleChat.getConfig().getString("server-name", "Server"));
// Finally, parse remaining placeholders and parse format
messageFormat = MiniMessageParser.handlePlaceholders(messageFormat, "message", event.getMessage());
Component formattedMessage = MiniMessageParser.parseFormat(messageFormat);
@@ -52,8 +52,11 @@ public class TownChatChannel extends SimpleChatChannel {
Component component = LegacyComponentSerializer.legacy('&').deserialize(messageFormat);
messageFormat = MiniMessageSerializer.serialize(component);
// Continue parsing the format
messageFormat = MiniMessageParser.handlePlaceholders(messageFormat, "color", "<" + getColor().toString() + ">");
// First pass for placeholders, to support placeholders in placeholders
messageFormat = MiniMessageParser.handlePlaceholders(messageFormat, "color", "<" + getColor().toString() + ">",
"phase", Long.toString(System.currentTimeMillis() % 25), "server", getSimpleChat().getConfig().getString("server-name", "Server"));
// Finally, parse remaining placeholders and parse format
messageFormat = MiniMessageParser.handlePlaceholders(messageFormat, "message", event.getMessage());
Component formattedMessage = MiniMessageParser.parseFormat(messageFormat);
+10 -4
View File
@@ -1,4 +1,7 @@
# https://github.com/MiniDigger/MiniMessage/blob/feature/adventure/DOCS.md
# IMPORTANT: Use the <pre> tag around ALL user inputs.
# All <message> placeholders should be prefixed with <pre> and suffixed with </pre>
# Failure to do so may and likely will result in users being able to inject formatting in messages.
channels:
global:
@@ -7,17 +10,20 @@ channels:
toggle-on-message: '<gray>You can now see <color><channel> <gray>chat!'
toggle-off-message: '<gray>You can no longer see <color><channel> <gray>chat!'
formats:
discord-to-mc: '<gray>[<blue>Discord<gray>] <username><white>: <message>' # Placeholders: username, displayname, channel, server, message, primaryrole
staff: '<gray>{[%deluxetags_tag%<gray>]} %player_displayname% <gray>» <white><message>'
default: '<gray>[%deluxetags_tag%<gray>] %player_displayname%<gray>: <white><message>'
discord-to-mc: '<gray>[<blue>Discord<gray>] <username><white>: <pre><message>' # Placeholders: username, displayname, channel, server, message, primaryrole
staff: '<gray>{[%deluxetags_tag%<gray>]} %player_displayname% <gray>» <white><pre><message>'
default: '<gray>[%deluxetags_tag%<gray>] %player_displayname%<gray>: <white><pre><message>'
webhook: 'URL_HERE' # Comment out / remove to disable webhook
color: WHITE # Removing this option defaults to 'WHITE'
default: true # Removing this option defaults to 'false'
ignorable: true # Removing this option defaults to 'true'
distance: -1 # Set to -1, comment out, or remove to disable distance checking
forward-format: true # Removing this option defaults to 'true'. Forces all other servers to use this server's formatting for this channel.
bot-token: -1
language:
ignoring-user: '<green>You are now ignoring <gold><player><green>!'
not-ignoring-user: '<green>You are no longer ignoring <gold><player><green>!'
not-ignoring-user: '<green>You are no longer ignoring <gold><player><green>!'
server-name: 'Server'