mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 14:38:51 +00:00
Config improvements
This commit is contained in:
1 parent
05289190b4
commit
38d71e5ef9
2 files changed
+50
-12
No files matched your search
@@ -24,6 +24,7 @@ public class ChannelManager {
|
|||||||
ChatChannel.Builder builder;
|
ChatChannel.Builder builder;
|
||||||
|
|
||||||
ConfigurationSection section = simpleChat.getConfig().getConfigurationSection("channels").getConfigurationSection(key);
|
ConfigurationSection section = simpleChat.getConfig().getConfigurationSection("channels").getConfigurationSection(key);
|
||||||
|
ConfigurationSection defaults = simpleChat.getConfig().getConfigurationSection("default");
|
||||||
|
|
||||||
if (section.contains("is-town-chat")) {
|
if (section.contains("is-town-chat")) {
|
||||||
builder = TownChatChannel.townBuilder(key);
|
builder = TownChatChannel.townBuilder(key);
|
||||||
@@ -54,6 +55,16 @@ public class ChannelManager {
|
|||||||
formats.put(group, formatSection.getString(group));
|
formats.put(group, formatSection.getString(group));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
builder.setFormats(formats);
|
||||||
|
} else if (defaults != null && defaults.contains("formats")) {
|
||||||
|
HashMap<String, String> formats = new HashMap<>();
|
||||||
|
|
||||||
|
ConfigurationSection formatSection = defaults.getConfigurationSection("formats");
|
||||||
|
|
||||||
|
for (String group : formatSection.getKeys(false)) {
|
||||||
|
formats.put(group, formatSection.getString(group));
|
||||||
|
}
|
||||||
|
|
||||||
builder.setFormats(formats);
|
builder.setFormats(formats);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,10 +74,14 @@ public class ChannelManager {
|
|||||||
|
|
||||||
if (section.contains("switch-message")) {
|
if (section.contains("switch-message")) {
|
||||||
builder.setSwitchMessage(section.getString("switch-message"));
|
builder.setSwitchMessage(section.getString("switch-message"));
|
||||||
|
} else if (defaults != null && defaults.contains("switch-message")) {
|
||||||
|
builder.setSwitchMessage(defaults.getString("switch-message"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (section.contains("distance")) {
|
if (section.contains("distance")) {
|
||||||
builder.setDistance(section.getDouble("distance"));
|
builder.setDistance(section.getDouble("distance"));
|
||||||
|
} else if (defaults != null && defaults.contains("distance")) {
|
||||||
|
builder.setDistance(defaults.getDouble("distance"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (section.contains("name")) {
|
if (section.contains("name")) {
|
||||||
@@ -75,10 +90,14 @@ public class ChannelManager {
|
|||||||
|
|
||||||
if (section.contains("color")) {
|
if (section.contains("color")) {
|
||||||
builder.setColor(section.getString("color"));
|
builder.setColor(section.getString("color"));
|
||||||
|
} else if (defaults != null && defaults.contains("color")) {
|
||||||
|
builder.setColor(defaults.getString("color"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (section.contains("ignorable")) {
|
if (section.contains("ignorable")) {
|
||||||
builder.setIgnorable(section.getBoolean("ignorable"));
|
builder.setIgnorable(section.getBoolean("ignorable"));
|
||||||
|
} else if (defaults != null && defaults.contains("ignorable")) {
|
||||||
|
builder.setIgnorable(defaults.getBoolean("ignorable"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (section.contains("default")) {
|
if (section.contains("default")) {
|
||||||
@@ -87,18 +106,26 @@ public class ChannelManager {
|
|||||||
|
|
||||||
if (section.contains("toggle-on-message")) {
|
if (section.contains("toggle-on-message")) {
|
||||||
builder.setToggleOnMessage(section.getString("toggle-on-message"));
|
builder.setToggleOnMessage(section.getString("toggle-on-message"));
|
||||||
|
} else if (defaults != null && defaults.contains("toggle-on-message")) {
|
||||||
|
builder.setToggleOnMessage(defaults.getString("toggle-on-message"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (section.contains("toggle-off-message")) {
|
if (section.contains("toggle-off-message")) {
|
||||||
builder.setToggleOffMessage(section.getString("toggle-off-message"));
|
builder.setToggleOffMessage(section.getString("toggle-off-message"));
|
||||||
|
} else if (defaults != null && defaults.contains("toggle-off-message")) {
|
||||||
|
builder.setToggleOffMessage(defaults.getString("toggle-off-message"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (section.contains("forward-format")) {
|
if (section.contains("forward-format")) {
|
||||||
builder.setShouldForwardFormatting(section.getBoolean("forward-format"));
|
builder.setShouldForwardFormatting(section.getBoolean("forward-format"));
|
||||||
|
} else if (defaults != null && defaults.contains("forward-format")) {
|
||||||
|
builder.setShouldForwardFormatting(defaults.getBoolean("forward-format"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (section.contains("should-bungee")) {
|
if (section.contains("should-bungee")) {
|
||||||
builder.setShouldBungee(section.getBoolean("should-bungee"));
|
builder.setShouldBungee(section.getBoolean("should-bungee"));
|
||||||
|
} else if (defaults != null && defaults.contains("should-bungee")) {
|
||||||
|
builder.setShouldBungee(defaults.getBoolean("should-bungee"));
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatChannel channel = builder.build(simpleChat);
|
ChatChannel channel = builder.build(simpleChat);
|
||||||
|
|||||||
@@ -3,23 +3,34 @@
|
|||||||
# All <message> placeholders should be prefixed with <pre> and suffixed with </pre>
|
# 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.
|
# Failure to do so may and likely will result in users being able to inject formatting in messages.
|
||||||
|
|
||||||
|
# All of the settings under this 'default' section can be applied to each channel individually to override these.
|
||||||
|
# These are provided as a way to configure default channel settings.
|
||||||
|
default:
|
||||||
|
switch-message: '<gray>You are now in <color><channel> <gray>chat!'
|
||||||
|
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>: <pre><message>' # Placeholders: username, displayname, channel, server, message, primaryrole
|
||||||
|
staff: '<gray>{[%vault_prefix%<gray>]} %player_displayname% <gray>» <white><pre><message>'
|
||||||
|
default: '<gray>[%vault_prefix%<gray>] %player_displayname%<gray>: <white><pre><message>'
|
||||||
|
color: '#FFFFFF' # Removing this option defaults to '#FFFFFF'
|
||||||
|
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.
|
||||||
|
should-bungee: true # Removing this option defaults to 'false'. Enables/disables cross server chat for this channel.
|
||||||
|
|
||||||
channels:
|
channels:
|
||||||
global:
|
global:
|
||||||
|
name: 'Global'
|
||||||
id: -1 # Set to -1, comment out, or remove to disable channel bridge
|
id: -1 # Set to -1, comment out, or remove to disable channel bridge
|
||||||
switch-message: '<gray>You are now in <color><channel> <gray>chat!'
|
|
||||||
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>: <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
|
webhook: 'URL_HERE' # Comment out / remove to disable webhook
|
||||||
color: '#FFFFFF' # Removing this option defaults to '#FFFFFF'
|
|
||||||
default: true # Removing this option defaults to 'false'
|
default: true # Removing this option defaults to 'false'
|
||||||
ignorable: true # Removing this option defaults to 'true'
|
announcements:
|
||||||
distance: -1 # Set to -1, comment out, or remove to disable distance checking
|
name: 'Announcements'
|
||||||
forward-format: true # Removing this option defaults to 'true'. Forces all other servers to use this server's formatting for this channel.
|
formats:
|
||||||
should-bungee: true # Removing this option defaults to 'false'. Enables/disables cross server chat for this channel.
|
default: '<gold>Broadcast: <yellow><pre><message></pre>'
|
||||||
|
ignorable: false
|
||||||
|
should-bungee: false
|
||||||
|
|
||||||
bot-token: -1
|
bot-token: -1
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user