diff --git a/CarbonChat-API/build.gradle b/CarbonChat-API/build.gradle index eb9e4d02..00728f8b 100644 --- a/CarbonChat-API/build.gradle +++ b/CarbonChat-API/build.gradle @@ -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' diff --git a/CarbonChat-Bukkit/build.gradle b/CarbonChat-Bukkit/build.gradle index 7376940f..a499d02d 100644 --- a/CarbonChat-Bukkit/build.gradle +++ b/CarbonChat-Bukkit/build.gradle @@ -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' diff --git a/CarbonChat-Bukkit/src/main/java/net/draycia/carbon/bukkit/CarbonChatBukkit.java b/CarbonChat-Bukkit/src/main/java/net/draycia/carbon/bukkit/CarbonChatBukkit.java index c2157bc1..fe97e6b0 100644 --- a/CarbonChat-Bukkit/src/main/java/net/draycia/carbon/bukkit/CarbonChatBukkit.java +++ b/CarbonChat-Bukkit/src/main/java/net/draycia/carbon/bukkit/CarbonChatBukkit.java @@ -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) diff --git a/CarbonChat-Common/src/main/resources/carbonCommands.conf b/CarbonChat-Common/src/main/resources/carbonCommands.conf deleted file mode 100644 index 742d6d8d..00000000 --- a/CarbonChat-Common/src/main/resources/carbonCommands.conf +++ /dev/null @@ -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" - } - } -} diff --git a/CarbonChat-Common/src/main/resources/channels.yml b/CarbonChat-Common/src/main/resources/channels.yml new file mode 100644 index 00000000..2987f105 --- /dev/null +++ b/CarbonChat-Common/src/main/resources/channels.yml @@ -0,0 +1,69 @@ +channel-options: + global: + # The command aliases for this channel + aliases: [] + # This is what the 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 placeholder is also used for personal and global user colors. + color: "#FFFFFF" + # The order in which colors are chosen for the 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: "<> " + # 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, wil be replaced with %vault_group% +custom-placeholders: + group: "%vault_group%" + prefix: "[]" + +# 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: "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: "<> " + staff: "<#00CED1>[Staff] <> " + group-overrides: [] + honors-recipient-list: false + ignorable: true + permission-group-matching: false + primary-group-only: false + should-cancel-chat-event: false + switch-failure-message: "You cannot use channel !" + switch-message: "You are now in chat!" + switch-other-message: " is now in chat!" + toggle-off-message: "You can no longer see chat!" + toggle-on-message: "You can now see chat!" + toggle-other-off-message: " can no longer see + chat!" + toggle-other-on-message: " can now see + chat!" diff --git a/CarbonChat-Common/src/main/resources/carbon-commands.yml b/CarbonChat-Common/src/main/resources/commands.yml similarity index 52% rename from CarbonChat-Common/src/main/resources/carbon-commands.yml rename to CarbonChat-Common/src/main/resources/commands.yml index 84a89347..d961830f 100644 --- a/CarbonChat-Common/src/main/resources/carbon-commands.yml +++ b/CarbonChat-Common/src/main/resources/commands.yml @@ -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] diff --git a/CarbonChat-Common/src/main/resources/config.yml b/CarbonChat-Common/src/main/resources/config.yml new file mode 100644 index 00000000..8a6a0367 --- /dev/null +++ b/CarbonChat-Common/src/main/resources/config.yml @@ -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: "" + # 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 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: "[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: "You cannot ignore that channel!" + cannot-use-message: You cannot use that channel! + console-format: "[ -> ] " + log-to-console: true + now-whispering-player: "You are now whispering !" + pings: + enabled: true + sound: + name: minecraft:entity.experience_orb.pickup + pitch: 1 + source: PLAYER + volume: 10 + receiver-format: "[ -> Me] " + receiver-toggled-off: " has whispers toggled off!" + sender-format: "[Me -> ] " + sender-toggled-off: "You have whispers toggled off!" + switch-failure-message: "You cannot use channel !" + switch-message: "You are now in chat!" + switch-other-message: " is now in chat!" + toggle-off-message: "You can no longer see chat!" + toggle-on-message: "You can now see chat!" + toggle-other-off-message: " can no longer see + chat!" + toggle-other-on-message: " can now see + chat!" diff --git a/CarbonChat-Common/src/main/resources/language.yml b/CarbonChat-Common/src/main/resources/language.yml new file mode 100644 index 00000000..0db206c9 --- /dev/null +++ b/CarbonChat-Common/src/main/resources/language.yml @@ -0,0 +1,47 @@ +available-channels-list: "Available Channels: ." +cannot-set-color: "You do not have permission to set a color for this channel!" +cannot-whisper-self: "You cannot whisper yourself!" +channel-color-set: "You have set color to !" +channel-list-separator: ", " +channel-ping-changed: "Channel ping settings changed!" +clear-exempt: "You were exempt from the clear due to your permissions!" +clear-notify: "Chat has been cleared by ." +context-messages: + mcmmo-party-not-in-party: "You are not in a party!" + towny-town-not-in-town: "You are not in a town!" + vault-balance-not-enough: "You do not have enough balance, required: ." + vault-cost-not-enough: "You do not have enough balance, cost: ." +exception-messages: + channel-not-found: Channel not found! + channel-not-public: Channel is not public! + player-not-found: Player not found! +ignore-exempt: "User is exempt from being ignored!" +ignoring-user: "You are now ignoring !" +invalid-color: "The input is not a valid color!" +mute-exempt: "Player is exempt from being muted!" +nickname-reset: "Your nickname was reset!" +nickname-set: "Your nickname was set to !" +no-longer-muted: "Player is no longer muted!" +no-longer-shadow-muted: "Player is no longer shadow muted!" +no-reply-target: "You have no one to reply to!" +not-ignoring-user: "You are no longer ignoring !" +now-muted: "Player is now muted!" +now-shadow-muted: "Player is now shadow muted!" +other-nickname-reset: "'s nickname was reset!" +other-nickname-set: "''s nickname was set to !" +other-player-offline: "That player is offline!" +reloaded: "Chat config has been reloaded!" +reply-message-blank: "Your reply message was blank!" +roleplay-format: "* *" +shadow-mute-exempt: "Player is exempt from being shadow muted!" +spy-everything-off: "All spying toggled off!" +spy-everything-on: "All spying toggled on!" +spy-toggled-off: "You are no longer spying on chat!" +spy-toggled-on: "You are now spying on chat!" +spy-whispers: "Spy [ -> ] + " +spy-whispers-off: "You are no longer spying on whispers!" +spy-whispers-on: "You are now spying on whispers!" +unavailable-channels-list: "Unavailable Channels: ." +user-must-be-online: " must be online!" +whisper-ping-changed: "Whisper ping settings changed!" diff --git a/CarbonChat-Common/src/main/resources/moderation.yml b/CarbonChat-Common/src/main/resources/moderation.yml new file mode 100644 index 00000000..6458808f --- /dev/null +++ b/CarbonChat-Common/src/main/resources/moderation.yml @@ -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] "