Implement FormatType as a config setting (#103)

* Implement FormatType as a config setting

* Remove TODO.
This commit is contained in:
Glare authored and GitHub committed 2020-10-17 13:17:49 -07:00
1 parent 8e91232345
commit 4a36172cdb
2 files changed
+9 -1

No files matched your search

@@ -1,5 +1,6 @@
package net.draycia.carbon.api.config; package net.draycia.carbon.api.config;
import net.draycia.carbon.api.adventure.FormatType;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.spongepowered.configurate.CommentedConfigurationNode; import org.spongepowered.configurate.CommentedConfigurationNode;
@@ -60,6 +61,10 @@ public final class CarbonSettings {
@Comment("Options: NONE, REDIS, BUNGEECORD") @Comment("Options: NONE, REDIS, BUNGEECORD")
private @NonNull MessagingType messagingType = MessagingType.NONE; private @NonNull MessagingType messagingType = MessagingType.NONE;
@Setting
@Comment("Options: MOJANG, MINIMESSAGE_MARKDOWN, MINIMESSAGE, MINEDOWN")
private @NonNull FormatType formatType = FormatType.MOJANG;
@Setting @Setting
@Comment(" Options:\n" + @Comment(" Options:\n" +
" 'bungee' - Uses bungee plugin messaging, requires BungeeCord or another proxy which supports it (Velocity!)\n" + " 'bungee' - Uses bungee plugin messaging, requires BungeeCord or another proxy which supports it (Velocity!)\n" +
@@ -149,4 +154,7 @@ public final class CarbonSettings {
return this.whisperOptions; return this.whisperOptions;
} }
public @NonNull FormatType getFormatType() {
return formatType;
}
} }
@@ -127,7 +127,7 @@ public final class CarbonChatBukkit extends JavaPlugin implements CarbonChat {
// Setup Adventure // Setup Adventure
final BukkitAudiences audiences = BukkitAudiences.create(this); final BukkitAudiences audiences = BukkitAudiences.create(this);
this.messageProcessor = new AdventureManager(audiences, FormatType.MINIMESSAGE); // TODO: get format type from config this.messageProcessor = new AdventureManager(audiences, this.carbonSettings.getFormatType());
// Initialize managers // Initialize managers
this.channelManager = new ChannelManager(this); this.channelManager = new ChannelManager(this);