diff --git a/build-logic/src/main/kotlin/extensions.kt b/build-logic/src/main/kotlin/extensions.kt index 999621c9..a67c4778 100644 --- a/build-logic/src/main/kotlin/extensions.kt +++ b/build-logic/src/main/kotlin/extensions.kt @@ -64,7 +64,6 @@ fun Task.standardRelocations() { relocateDependency("net.kyori.moonshine") relocateDependency("com.seiama.registry") relocateDependency("org.spongepowered.configurate") - relocateDependency("com.typesafe.config") relocateDependency("com.google.thirdparty.publicsuffix") relocateDependency("com.zaxxer.hikari") relocateDependency("ninja.egg82.messenger") diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 61be443a..4fac2ccc 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -13,7 +13,6 @@ dependencies { api(libs.adventureSerializerConfigurate4) { isTransitive = false } - //api(libs.typesafeConfig) // Cloud api(platform(libs.cloudBom)) diff --git a/common/src/main/java/net/draycia/carbon/common/channels/ConfigChatChannel.java b/common/src/main/java/net/draycia/carbon/common/channels/ConfigChatChannel.java index 622a94d5..e0ad5e4a 100644 --- a/common/src/main/java/net/draycia/carbon/common/channels/ConfigChatChannel.java +++ b/common/src/main/java/net/draycia/carbon/common/channels/ConfigChatChannel.java @@ -74,8 +74,7 @@ public class ConfigChatChannel implements ChatChannel { @Comment(""" The channel's key, used to track the channel. You only need to change the second part of the key. "global" by default. - The value is what's used in commands, this is probably what you want to change. - """) + The value is what's used in commands, this is probably what you want to change.""") protected @Nullable Key key = Key.key("carbon", "global"); @Comment(""" @@ -83,8 +82,7 @@ public class ConfigChatChannel implements ChatChannel { Assuming permission = "carbon.channel.global" To read messages you must have the permission carbon.channel.global.see - To send messages you must have the permission carbon.channel.global.speak - """) + To send messages you must have the permission carbon.channel.global.speak""") private @Nullable String permission = null; @Setting("format") @@ -105,14 +103,12 @@ public class ConfigChatChannel implements ChatChannel { @Comment(""" The distance players must be within to see each other's messages. A value of '0' requires that both players are in the same world. - On velocity, '0' requires that both players are in the same server. - """) + On velocity, '0' requires that both players are in the same server.""") private int radius = -1; @Comment(""" If true, players will be able to see if they're not sending messages to anyone - because they're out of range from the radius. - """) + because they're out of range from the radius.""") private boolean emptyRadiusRecipientsMessage = true; @Override diff --git a/common/src/main/java/net/draycia/carbon/common/channels/messages/ConfigChannelMessageSource.java b/common/src/main/java/net/draycia/carbon/common/channels/messages/ConfigChannelMessageSource.java index cb7059b0..23df6d68 100644 --- a/common/src/main/java/net/draycia/carbon/common/channels/messages/ConfigChannelMessageSource.java +++ b/common/src/main/java/net/draycia/carbon/common/channels/messages/ConfigChannelMessageSource.java @@ -67,8 +67,7 @@ public class ConfigChannelMessageSource implements IMessageSource> locales = Map.of(Locale.getDefault(), Map.of()); private static final String FALLBACK_FORMAT = "<> "; diff --git a/common/src/main/java/net/draycia/carbon/common/config/DatabaseSettings.java b/common/src/main/java/net/draycia/carbon/common/config/DatabaseSettings.java index a3de93d5..a4c40bf3 100644 --- a/common/src/main/java/net/draycia/carbon/common/config/DatabaseSettings.java +++ b/common/src/main/java/net/draycia/carbon/common/config/DatabaseSettings.java @@ -42,8 +42,7 @@ public class DatabaseSettings { JDBC URL. Suggested defaults for each DB: MySQL: jdbc:mysql://host:3306/DB MariaDB: jdbc:mariadb://host:3306/DB - PostgreSQL: jdbc:postgresql://host:5432/database - """) + PostgreSQL: jdbc:postgresql://host:5432/database""") private String url = "jdbc:mysql://localhost:3306/carbon"; @Comment("The connection username.") diff --git a/common/src/main/java/net/draycia/carbon/common/config/PrimaryConfig.java b/common/src/main/java/net/draycia/carbon/common/config/PrimaryConfig.java index 0eb80998..cbe752d8 100644 --- a/common/src/main/java/net/draycia/carbon/common/config/PrimaryConfig.java +++ b/common/src/main/java/net/draycia/carbon/common/config/PrimaryConfig.java @@ -45,33 +45,31 @@ public class PrimaryConfig { @Comment(""" The default channel that new players will be in when they join. - If the channel is not found or the player cannot use the channel, they will speak in basic non-channel chat. - """) + If the channel is not found or the player cannot use the channel, they will speak in basic non-channel chat.""") private Key defaultChannel = Key.key("carbon", "global"); @Comment(""" The service that will be used to store and load player information. One of: JSON, H2, MYSQL, PSQL - Note: If you choose MYSQL or PSQL make sure you configure the "database-settings" section of this file! - """) + Note: If you choose MYSQL or PSQL make sure you configure the "database-settings" section of this file!""") private StorageType storageType = StorageType.JSON; @Comment(""" When "storage-type" is set to MYSQL or PSQL, this section configures the database connection. - If JSON or H2 storage is used, this section can be ignored. - """) + If JSON or H2 storage is used, this section can be ignored.""") private DatabaseSettings databaseSettings = new DatabaseSettings(); - @Comment("Various ClearChat command settings.") - private ClearChatSettings clearChatSettings = new ClearChatSettings(); + @Comment("Settings for cross-server messaging") + private MessagingSettings messagingSettings = new MessagingSettings(); + + private NicknameSettings nicknameSettings = new NicknameSettings(); @Comment(""" Plugin-wide custom placeholders. These will be parsed in all messages rendered and sent by Carbon. This includes chat, command feedback, and others. Make sure to close your tags so they do not bleed into other formats. - Only a single pass is done so custom placeholders will not work within each other. - """) + Only a single pass is done so custom placeholders will not work within each other.""") private Map customPlaceholders = Map.of(); @Comment("The suggestions shown when using the TAB key in chat.") @@ -86,7 +84,9 @@ public class PrimaryConfig { @Comment("Various settings related to pinging players in channels.") private PingSettings pingSettings = new PingSettings(); - @Comment("Various sound settings for messages.") + private PartySettings partyChat = new PartySettings(); + + @Comment("Sound for receiving a direct message") // TODO migrate to a field name that makes more sense private @Nullable Sound messageSound = Sound.sound( Key.key("entity.experience_orb.pickup"), Sound.Source.MASTER, @@ -94,9 +94,8 @@ public class PrimaryConfig { 1.0F ); - private MessagingSettings messagingSettings = new MessagingSettings(); - private NicknameSettings nicknameSettings = new NicknameSettings(); - private PartySettings partyChat = new PartySettings(); + @Comment("Settings for the clear chat command") + private ClearChatSettings clearChatSettings = new ClearChatSettings(); @Comment("Settings for integrations with other plugins/mods") private IntegrationConfigContainer integrations; @@ -104,14 +103,6 @@ public class PrimaryConfig { @Comment("Whether Carbon should check for updates using the GitHub API on startup.") private boolean updateChecker = true; - public PartySettings partyChat() { - return this.partyChat; - } - - public IntegrationConfigContainer integrations() { - return this.integrations; - } - public NicknameSettings nickname() { return this.nicknameSettings; } @@ -132,17 +123,13 @@ public class PrimaryConfig { return this.databaseSettings; } - public ClearChatSettings clearChatSettings() { - return this.clearChatSettings; - } - - public Map customPlaceholders() { - return this.customPlaceholders; + public MessagingSettings messagingSettings() { + return this.messagingSettings; } public String applyCustomPlaceholders(final String string) { String placeholderResolvedMessage = string; - for (final var entry : this.customPlaceholders().entrySet()) { + for (final var entry : this.customPlaceholders.entrySet()) { placeholderResolvedMessage = placeholderResolvedMessage.replace("<" + entry.getKey() + ">", entry.getValue()); } @@ -153,27 +140,19 @@ public class PrimaryConfig { return this.customChatSuggestions; } - public Map chatPlaceholders() { - return this.chatPlaceholders; - } - public String applyChatPlaceholders(final String string) { String placeholderResolvedMessage = string; - for (final var entry : this.chatPlaceholders().entrySet()) { + for (final var entry : this.chatPlaceholders.entrySet()) { placeholderResolvedMessage = placeholderResolvedMessage.replace("<" + entry.getKey() + ">", entry.getValue()); } return placeholderResolvedMessage; } - public Map chatFilters() { - return this.chatFilter; - } - public String applyChatFilters(final String string) { String filteredMessage = string; - for (final Map.Entry entry : this.chatFilters().entrySet()) { + for (final Map.Entry entry : this.chatFilter.entrySet()) { filteredMessage = filteredMessage.replaceAll(entry.getKey(), entry.getValue()); } @@ -184,14 +163,22 @@ public class PrimaryConfig { return this.pingSettings; } - public MessagingSettings messagingSettings() { - return this.messagingSettings; + public PartySettings partyChat() { + return this.partyChat; } public @Nullable Sound messageSound() { return this.messageSound; } + public ClearChatSettings clearChatSettings() { + return this.clearChatSettings; + } + + public IntegrationConfigContainer integrations() { + return this.integrations; + } + public boolean updateChecker() { return this.updateChecker; } @@ -226,15 +213,15 @@ public class PrimaryConfig { @ConfigSerializable public static final class NicknameSettings { + @Comment("Whether Carbon's nickname management should be used. Disable this if you wish to have another plugin manage nicknames.") + private boolean useCarbonNicknames = true; + @Comment("Minimum number of characters in nickname (excluding formatting).") private int minLength = 3; @Comment("Maximum number of characters in nickname (excluding formatting).") private int maxLength = 16; - @Comment("Whether Carbon's nickname management should be used. Disable this if you wish to have another plugin manage nicknames.") - private boolean useCarbonNicknames = true; - @Comment("Format used when displaying nicknames.") public String format = "@'>~"; @@ -257,6 +244,7 @@ public class PrimaryConfig { @ConfigSerializable public static final class PartySettings { + @Comment("Whether party chat is enabled") public boolean enabled = true; public int expireInvitesAfterSeconds = 45; diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6b877ae3..bfe8d54e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,8 +16,7 @@ runTask = "2.2.0" adventure = "4.14.0" cloud = "1.8.4" cloudSponge = "1.8.0-SNAPSHOT" -configurate = "4.1.2" -typesafeConfig = "1.4.3" +configurate = "4.2.0-SNAPSHOT" checkerQual = "3.39.0" stylecheck = "0.2.1" gson = "2.1" @@ -94,7 +93,6 @@ cloudFabric = { group = "cloud.commandframework", name = "cloud-fabric", version configurateCore = { group = "org.spongepowered", name = "configurate-core", version.ref = "configurate" } configurateHocon = { group = "org.spongepowered", name = "configurate-hocon", version.ref = "configurate" } configurateYaml = { group = "org.spongepowered", name = "configurate-yaml", version.ref = "configurate" } -typesafeConfig = { group = "com.typesafe", name = "config", version.ref = "typesafeConfig" } checkerQual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checkerQual" } stylecheck = { group = "ca.stellardrift", name = "stylecheck", version.ref = "stylecheck" } gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }