Switch to pregenerated commented yaml configs

This commit is contained in:
Draycia committed 2020-11-23 19:52:13 -08:00
1 parent 0045cebab3
commit 9eb93974a2
9 files changed
+313 -176

No files matched your search

+1 -1
View File
@@ -22,7 +22,7 @@ dependencies {
api 'cloud.commandframework:cloud-core:1.1.0'
api 'org.spongepowered:configurate-hocon:4.0.0-SNAPSHOT'
api 'org.spongepowered:configurate-yaml:4.0.0-SNAPSHOT'
api 'org.slf4j:slf4j-api:1.7.25'
api 'net.luckperms:api:5.1'
+1 -1
View File
@@ -6,7 +6,7 @@ plugins {
description = 'CarbonChat-Bukkit'
dependencies {
compile 'org.spongepowered:configurate-hocon:4.0.0-SNAPSHOT'
compile 'org.spongepowered:configurate-yaml:4.0.0-SNAPSHOT'
compile 'net.kyori:adventure-text-serializer-bungeecord:4.0.0-SNAPSHOT'
compile 'net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT'
@@ -75,7 +75,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongepowered.configurate.CommentedConfigurationNode;
import org.spongepowered.configurate.ConfigurateException;
import org.spongepowered.configurate.hocon.HoconConfigurationLoader;
import org.spongepowered.configurate.yaml.YamlConfigurationLoader;
import java.io.File;
import java.nio.file.Path;
@@ -260,10 +260,11 @@ public final class CarbonChatBukkit extends JavaPlugin implements CarbonChat {
this.loadCommandSettings();
}
// TODO: move config handling elsewhere, these should actually be in common
private void loadCarbonSettings() {
try {
final HoconConfigurationLoader loader =
this.loadConfigFile("config.conf", false);
final YamlConfigurationLoader loader =
this.loadConfigFile("config.yml", false);
final CommentedConfigurationNode node = loader.load();
this.carbonSettings = CarbonSettings.loadFrom(node);
@@ -275,8 +276,8 @@ public final class CarbonChatBukkit extends JavaPlugin implements CarbonChat {
private void loadLanguage() {
try {
final HoconConfigurationLoader loader =
this.loadConfigFile("language.conf", false);
final YamlConfigurationLoader loader =
this.loadConfigFile("language.yml", false);
final CommentedConfigurationNode node = loader.load();
this.translations = CarbonTranslations.loadFrom(node);
@@ -288,8 +289,8 @@ public final class CarbonChatBukkit extends JavaPlugin implements CarbonChat {
private void loadModerationSettings() {
try {
final HoconConfigurationLoader loader =
this.loadConfigFile("moderation.conf", false);
final YamlConfigurationLoader loader =
this.loadConfigFile("moderation.yml", false);
final CommentedConfigurationNode node = loader.load();
this.moderationSettings = ModerationSettings.loadFrom(node);
@@ -301,8 +302,8 @@ public final class CarbonChatBukkit extends JavaPlugin implements CarbonChat {
private void loadCommandSettings() {
try {
final HoconConfigurationLoader loader =
this.loadConfigFile("carbonCommands.conf", true);
final YamlConfigurationLoader loader =
this.loadConfigFile("commands.yml", true);
final CommentedConfigurationNode node = loader.load();
this.commandSettings = CommandSettingsRegistry.loadFrom(node);
@@ -314,8 +315,8 @@ public final class CarbonChatBukkit extends JavaPlugin implements CarbonChat {
private void loadChannelSettings() {
try {
final HoconConfigurationLoader loader =
this.loadConfigFile("channels.conf", false);
final YamlConfigurationLoader loader =
this.loadConfigFile("channels.yml", false);
final CommentedConfigurationNode node = loader.load();
this.channelSettings = ChannelSettings.loadFrom(node);
@@ -325,14 +326,14 @@ public final class CarbonChatBukkit extends JavaPlugin implements CarbonChat {
}
}
private HoconConfigurationLoader loadConfigFile(final String fileName, final boolean saveResource) {
private YamlConfigurationLoader loadConfigFile(final String fileName, final boolean saveResource) {
final File configFile = new File(this.getDataFolder(), fileName);
if (!(configFile.exists()) && saveResource) {
this.saveResource(fileName, false);
}
return HoconConfigurationLoader.builder()
return YamlConfigurationLoader.builder()
.defaultOptions(opts -> {
return opts.shouldCopyDefaults(true).serializers(builder -> {
builder.register(Key.class, KeySerializer.INSTANCE)
@@ -1,146 +0,0 @@
{
"registry": {
"channel": {
"aliases": [
"ch",
"join",
"switch"
],
"enabled": true,
"name": "channel"
},
"channellist": {
"aliases": [
"chlist"
],
"enabled": true,
"name": "channellist"
},
"chatreload": {
"aliases": [
"cr",
"creload"
],
"enabled": true,
"name": "chatreload"
},
"clearchat": {
"aliases": [
"cc",
"clear"
],
"enabled": true,
"name": "clearchat"
},
"ignore": {
"aliases": [
"block"
],
"enabled": true,
"name": "ignore"
},
"me": {
"aliases": [
"rp"
],
"enabled": true,
"name": "me"
},
"message": {
"aliases": [
"msg",
"w",
"whisper"
],
"enabled": true,
"name": "message"
},
"msgtoggle": {
"aliases": [
"messagetoggle"
],
"enabled": true,
"name": "msgtoggle"
},
"mute": {
"aliases": [
"m"
],
"enabled": true,
"name": "mute"
},
"nickname": {
"aliases": [
"nick"
],
"enabled": true,
"name": "nickname"
},
"pingoptions": {
"aliases": [
],
"enabled": true,
"name": "pingoptions"
},
"reply": {
"aliases": [
"r"
],
"enabled": true,
"name": "reply"
},
"setchannelcolor": {
"aliases": [
"schc",
"setchcolor"
],
"enabled": true,
"name": "setchannelcolor"
},
"setcolor": {
"aliases": [
"setcolor"
],
"enabled": true,
"name": "setcolor"
},
"shadowmute": {
"aliases": [
"sm",
"smute"
],
"enabled": true,
"name": "shadowmute"
},
"spy": {
"aliases": [
"spych",
"spychannel"
],
"enabled": true,
"name": "spy"
},
"sudochannel": {
"aliases": [
"channelsudo",
"chsudo",
"sch",
"schannel",
"sudoch"
],
"enabled": true,
"name": "sudochannel"
},
"toggle": {
"aliases": [
"tch",
"tchannel",
"togglec",
"togglech",
"togglechannel"
],
"enabled": true,
"name": "toggle"
}
}
}
@@ -0,0 +1,69 @@
channel-options:
global:
# The command aliases for this channel
aliases: []
# This is what the <color> placeholder will typically be replaced with.
# Hex RGB (#B19CD9), named colors (light_purple), legacy (&d), and legacy RGB (&x&b&1&2&c&d&9) are all supported.
# If on a platform that supports PlaceholderAPI, this option will be ran through that as well.
# Note that the <color> placeholder is also used for personal and global user colors.
color: "#FFFFFF"
# The order in which colors are chosen for the <color> tag.
# Options:
# PLAYER: The color the player has set with /setcolor
# CUSTOM: The color the player has set with /setchannelcolor
# CHANNEL: The color the channel has set in its settings
color-priorities:
- PLAYER
- CUSTOM
- CHANNEL
# The contexts for this channel, which can modify the behaviour of channels and how/when players can use them.
contexts: {}
# The name of the format that the plugin will fall back to when it cannot find a matching format for the player's groups.
default-format-name: default
# The formats for this channel. The key is the name of the group as your permissions plugin reports it.
formats:
default: "<color><<displayname><reset><color>> <message>"
# If this channel is the default channel players join in.
# Also used as a fallback in case the player's selected channel cannot be found.
is-default: true
# What this channel is identified as. This will be what's typed ingame to use the channel.
key: global
# If the player's chat message starts with whatever this is set to, the player speaks in this channel instead of their selected one
message-prefix: ''
# The display name of this channel, supports minimessage. Used in command feedback
name: Global
# Used for message formats - custom tags that are replaced in descending order
# For example, in the default config, <group> wil be replaced with <green>%vault_group%
custom-placeholders:
group: "<green>%vault_group%"
prefix: "<gray>[<group><gray>]"
# All options here act like the defaults for all channels.
# Adding any of these options to any channel overrides the relevant defaults.
shared-channel-options:
cannot-ignore-message: "<red>You cannot ignore that channel!"
cannot-use-message: You cannot use that channel!
color: "#FFFFFF"
color-priorities: []
contexts: {}
cross-server: true
default-format-name: default
formats:
default: "<color><<displayname><reset><color>> <message>"
staff: "<#00CED1>[Staff] <color><<displayname><reset><color>> <message>"
group-overrides: []
honors-recipient-list: false
ignorable: true
permission-group-matching: false
primary-group-only: false
should-cancel-chat-event: false
switch-failure-message: "<red>You cannot use channel <channel>!"
switch-message: "<gray>You are now in <color><channel> <gray>chat!"
switch-other-message: "<gray><player> <reset><gray>is now in <color><channel> <gray>chat!"
toggle-off-message: "<gray>You can no longer see <color><channel> <gray>chat!"
toggle-on-message: "<gray>You can now see <color><channel> <gray>chat!"
toggle-other-off-message: "<gray><player> <reset><gray>can no longer see <color><channel>
<gray>chat!"
toggle-other-on-message: "<gray><player> <reset><gray>can now see <color><channel>
<gray>chat!"
@@ -1,61 +1,97 @@
registry:
channel:
aliases:
- ch
- switch
- join
enabled: true
name: channel
aliases: [ch, switch, join]
channellist:
aliases:
- chlist
enabled: true
name: channellist
aliases: [chlist]
chatreload:
aliases:
- creload
- cr
enabled: true
name: chatreload
aliases: [creload, cr]
clearchat:
aliases:
- clear
- cc
enabled: true
name: clearchat
aliases: [clear, cc]
ignore:
aliases:
- block
enabled: true
name: ignore
aliases: [block]
me:
aliases:
- rp
enabled: true
name: me
aliases: [rp]
message:
aliases:
- msg
- whisper
- w
enabled: true
name: message
aliases: [msg, whisper, w]
msgtoggle:
aliases:
- messagetoggle
enabled: true
name: msgtoggle
mute:
aliases:
- m
enabled: true
name: mute
aliases: [m]
nickname:
aliases:
- nick
enabled: true
name: nickname
aliases: [nick]
reply:
aliases:
- r
enabled: true
name: reply
aliases: [r]
setcolor:
aliases:
- setcolor
enabled: true
name: setcolor
aliases: [setcolor]
shadowmute:
aliases:
- sm
- smute
enabled: true
name: shadowmute
aliases: [sm, smute]
spy:
aliases:
- spych
- spychannel
enabled: true
name: spy
aliases: [spych, spychannel]
sudochannel:
aliases:
- sch
- sudoch
- schannel
- chsudo
- channelsudo
enabled: true
name: sudochannel
aliases: [sch, sudoch, schannel, chsudo, channelsudo]
toggle:
aliases:
- togglechannel
- tch
- togglech
- tchannel
- togglec
enabled: true
name: toggle
aliases: [togglechannel, tch, togglech, tchannel, togglec]
@@ -0,0 +1,93 @@
# Sets the player's channel to the specified channel when they join
# Set to "" or remove to disable
# Set to DEFAULT to set the player's channel to the default channel on join
# Otherwise, set to a channel to set the player's channel to it on join
# For example, channel-on-join: "global" sets their channel to global on join
channel-on-join: ''
# Plays a sound and highlights the message when someone types your name
channel-pings:
# If player names are case sensitive, if true you must type Player to ping Player, 'player' will not work
case-sensitive: false
# The way players will see the ping
display: "<bold><red><ping></red><bold>"
# Determines if this feature is enabled
enabled: true
# The text that pings must begin with. A prefix of '@' means you have to type '@Player' to ping Player
prefix: '@'
# The sound played to the pinged player
sound:
name: minecraft:entity.experience_orb.pickup
pitch: 1
source: PLAYER
volume: 10
# Options: MOJANG, MINIMESSAGE_MARKDOWN, MINIMESSAGE, MINEDOWN
format-type: MINIMESSAGE
# The list of regex patterns to show items in chat. '\\Q' and '\\E' just denote that the content isn't regex.
item-link-patterns:
- "\\Q[item]\\E"
# Options: NONE, REDIS, BUNGEECORD
# 'BUNGEE' - Uses bungee plugin messaging, requires BungeeCord or another proxy which supports it (Velocity!)
# 'REDIS' - Uses redis for cross server syncing, does not require a server proxy
# 'NONE' - Do not sync anything cross server, this is the default
# Note: In order for channels to sync cross server, you'll need to enable is-cross-server for the
# channel as well as this setting.
messaging-type: NONE
# The credentials necessary to connect to your redis server
redis-credentials:
database: 0
host: localhost
password: ''
port: 6379
# Used for <server> placeholder in formats
server-name: Server
# Set this to false to disable warnings and tips when the plugin thinks there may be configuration issues.
show-tips: true
# The prefix shown when spying on a user's message
spy-prefix: "<color>[SPY] "
# The credentials used to connect to your database. Requires storageType=MYSQL
sql-credentials:
database: database
host: host
password: password
port: 3306
username: username
# Options: JSON, MYSQL
storage-type: JSON
# Various options relating to the /whisper command
whisper-options:
cannot-ignore-message: "<red>You cannot ignore that channel!"
cannot-use-message: You cannot use that channel!
console-format: "<gold>[<white><sender> <gray>-> <white><receiver><gold>] <message>"
log-to-console: true
now-whispering-player: "<white>You are now whispering <green><player><white>!"
pings:
enabled: true
sound:
name: minecraft:entity.experience_orb.pickup
pitch: 1
source: PLAYER
volume: 10
receiver-format: "<gold>[<white><sender> <gray>-> <white>Me<gold>] <message>"
receiver-toggled-off: "<red><receiver> <red>has whispers toggled off!"
sender-format: "<gold>[<white>Me <gray>-> <white><receiver><gold>] <message>"
sender-toggled-off: "<red>You have whispers toggled off!"
switch-failure-message: "<red>You cannot use channel <channel>!"
switch-message: "<gray>You are now in <color><channel> <gray>chat!"
switch-other-message: "<gray><player> <reset><gray>is now in <color><channel> <gray>chat!"
toggle-off-message: "<gray>You can no longer see <color><channel> <gray>chat!"
toggle-on-message: "<gray>You can now see <color><channel> <gray>chat!"
toggle-other-off-message: "<gray><player> <reset><gray>can no longer see <color><channel>
<gray>chat!"
toggle-other-on-message: "<gray><player> <reset><gray>can now see <color><channel>
<gray>chat!"
@@ -0,0 +1,47 @@
available-channels-list: "<green>Available Channels:<reset> <list>."
cannot-set-color: "<red>You do not have permission to set a color for this channel!"
cannot-whisper-self: "<yellow>You cannot whisper yourself!"
channel-color-set: "<green>You have set <color><channel> <green>color to <hex>!"
channel-list-separator: ", "
channel-ping-changed: "<green>Channel ping settings changed!"
clear-exempt: "<yellow>You were exempt from the clear due to your permissions!"
clear-notify: "<yellow>Chat has been cleared by <player>."
context-messages:
mcmmo-party-not-in-party: "<red>You are not in a party!"
towny-town-not-in-town: "<red>You are not in a town!"
vault-balance-not-enough: "<red>You do not have enough balance, required: <balance><red>."
vault-cost-not-enough: "<red>You do not have enough balance, cost: <balance><red>."
exception-messages:
channel-not-found: Channel not found!
channel-not-public: Channel is not public!
player-not-found: Player not found!
ignore-exempt: "<red>User <player> <red>is exempt from being ignored!"
ignoring-user: "<green>You are now ignoring <gold><player><reset><green>!"
invalid-color: "<red>The input <input> is not a valid color!"
mute-exempt: "<red>Player <player> is exempt from being muted!"
nickname-reset: "<green>Your nickname was reset!"
nickname-set: "<green>Your nickname was set to <nickname><reset><green>!"
no-longer-muted: "<yellow>Player <player> is no longer muted!"
no-longer-shadow-muted: "<yellow>Player <player> is no longer shadow muted!"
no-reply-target: "<red>You have no one to reply to!"
not-ignoring-user: "<green>You are no longer ignoring <gold><player><reset><green>!"
now-muted: "<yellow>Player <player> is now muted!"
now-shadow-muted: "<yellow>Player <player> is now shadow muted!"
other-nickname-reset: "<green><user><reset>'s nickname was reset!"
other-nickname-set: "<green><user><reset>''s nickname was set to <nickname><green>!"
other-player-offline: "<red>That player is offline!"
reloaded: "<yellow>Chat config has been reloaded!"
reply-message-blank: "<red>Your reply message was blank!"
roleplay-format: "<italic><dark_purple>*<displayname> <reset><message>*</dark_purple></italic>"
shadow-mute-exempt: "<red>Player <player> is exempt from being shadow muted!"
spy-everything-off: "<gray>All spying toggled off!"
spy-everything-on: "<gray>All spying toggled on!"
spy-toggled-off: "<gray>You are no longer spying on <color><channel> <gray>chat!"
spy-toggled-on: "<gray>You are now spying on <color><channel> <gray>chat!"
spy-whispers: "<yellow>Spy [<gray><sender><reset> <gold>-> <gray><target><reset><yellow>]
<message>"
spy-whispers-off: "<gray>You are no longer spying on whispers!"
spy-whispers-on: "<gray>You are now spying on whispers!"
unavailable-channels-list: "<red>Unavailable Channels:<reset> <list>."
user-must-be-online: "<red><player> must be online!"
whisper-ping-changed: "<green>Whisper ping settings changed!"
@@ -0,0 +1,37 @@
caps-protection:
# If true, stops message from sending. If false, simply changes the message to lowercase
block-message: false
# If caps protection is enabled
enabled: true
# The minimum message length for caps protection to activate
minimum-length: 10
# The amount of letters in the message for it to trigger the protection
percent-caps: 0.800000011920929
clear-chat:
# The message sent to clear chat, you probably want to leave this blank
message: ''
# How many messages will be sent in order to clear chat
message-count: 100
filters:
# Anything in blocked-words will prevent the message from being sent at all.
# Set to blocked-words: [] if you want to disable the blocked words feature.
blocked-patterns:
- pineapple doesn't belong on pizza
# If filtering / replacements is enabled
enabled: true
# Regex based filtering
# The keys ("****" for example) are what the text is replaced with.
# The strings in the lists ("lag" etc) are what's replaced.
# Set to filters: {} if you want to disable the filter feature.
# Set the key to "_" for the replacement to be blank (remove the filtered pattern).
replacements:
"****":
- la[g]+
# If true, muted users will be unable to use /whisper /msg
mute-stops-whispers: true
# The text that's prepended to someone else's shadowmuted messages.
shadow-mute-prefix: "[SM] "