Update configurate to 4.2.0-SNAPSHOT (#342)

This commit is contained in:
Jason Penilla authored and GitHub committed 2023-11-11 09:32:08 -07:00
1 parent c35acc38fc
commit ca1c546b50
7 files changed
+39 -61

No files matched your search

@@ -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
@@ -67,8 +67,7 @@ public class ConfigChannelMessageSource implements IMessageSource<SourcedAudienc
Per-Language chat formats.
You can safely leave this section empty if you don't want to use this feature.
Each locale section can be configured in the same way as the above 'basic' section.
Will fall back to the 'basic' section if no format was found for the player's locale.
""")
Will fall back to the 'basic' section if no format was found for the player's locale.""")
public Map<Locale, Map<String, String>> locales = Map.of(Locale.getDefault(), Map.of());
private static final String FALLBACK_FORMAT = "<red><</red><username><red>></red> <message>";
@@ -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.")
@@ -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<String, String> 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<String, String> 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<String, String> 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<String, String> chatFilters() {
return this.chatFilter;
}
public String applyChatFilters(final String string) {
String filteredMessage = string;
for (final Map.Entry<String, String> entry : this.chatFilters().entrySet()) {
for (final Map.Entry<String, String> 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 = "<hover:show_text:'<gray>@</gray><username>'><gray>~</gray><nickname></hover>";
@@ -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;