Adjust item link handler and move custom placeholders

This commit is contained in:
Draycia committed 2020-10-21 00:48:29 -07:00
1 parent 2eff673caa
commit 3314a51df8
4 files changed
+27 -22

No files matched your search

@@ -11,9 +11,7 @@ import org.spongepowered.configurate.objectmapping.meta.Setting;
import org.spongepowered.configurate.serialize.SerializationException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
@ConfigSerializable
@@ -74,16 +72,6 @@ public final class CarbonSettings {
@Comment("The credentials necessary to connect to your redis server")
private @NonNull RedisCredentials redisCredentials = new RedisCredentials();
@Setting
@Comment("Used for message formats - custom tags that are replaced in descending order" +
"\nFor example, in the default config, <group> wil be replaced with <green>%vault_group%")
private @NonNull Map<@Nullable String, @NonNull String> customPlaceholders = new HashMap<String, String>() {
{
this.put("prefix", "<gray>[<group><gray>]");
this.put("group", "<green>%vault_group%");
}
};
@Setting
@Comment("Plays a sound and highlights the message when someone types your name")
private @NonNull ChannelPings channelPings = new ChannelPings();
@@ -137,10 +125,6 @@ public final class CarbonSettings {
return this.redisCredentials;
}
public Map<String, String> customPlaceholders() {
return this.customPlaceholders;
}
public @Nullable String channelOnJoin() {
return this.channelOnJoin;
}
@@ -1,5 +1,7 @@
package net.draycia.carbon.api.config;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.spongepowered.configurate.CommentedConfigurationNode;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
import org.spongepowered.configurate.objectmapping.ObjectMapper;
@@ -8,6 +10,7 @@ import org.spongepowered.configurate.objectmapping.meta.Setting;
import org.spongepowered.configurate.serialize.SerializationException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@ConfigSerializable
@@ -40,6 +43,16 @@ public final class ChannelSettings {
private Map<String, ChannelOptions> channelOptions =
Collections.singletonMap("global", ChannelOptions.defaultChannel());
@Setting
@Comment("Used for message formats - custom tags that are replaced in descending order" +
"\nFor example, in the default config, <group> wil be replaced with <green>%vault_group%")
private @NonNull Map<@Nullable String, @NonNull String> customPlaceholders = new HashMap<String, String>() {
{
this.put("prefix", "<gray>[<group><gray>]");
this.put("group", "<green>%vault_group%");
}
};
public SharedChannelOptions defaultChannelOptions() {
return this.sharedChannelOptions;
}
@@ -48,6 +61,10 @@ public final class ChannelSettings {
return this.channelOptions;
}
public Map<String, String> customPlaceholders() {
return this.customPlaceholders;
}
public ChannelOptions channelOptions(final String name) {
return this.channelOptions.get(name);
}