mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2024-12-25 17:08:27 +01:00
Reorganize config packages, rename a bunch of ConfigurateConfigManager members
This commit is contained in:
parent
9897f7029d
commit
20683e3c7a
@ -41,8 +41,8 @@ import com.discordsrv.bukkit.scheduler.FoliaScheduler;
|
||||
import com.discordsrv.bukkit.scheduler.IBukkitScheduler;
|
||||
import com.discordsrv.common.ServerDiscordSRV;
|
||||
import com.discordsrv.common.command.game.handler.ICommandHandler;
|
||||
import com.discordsrv.common.config.manager.ConnectionConfigManager;
|
||||
import com.discordsrv.common.config.manager.MainConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
|
||||
import com.discordsrv.common.debug.data.OnlineMode;
|
||||
import com.discordsrv.common.messageforwarding.game.minecrafttodiscord.MinecraftToDiscordChatModule;
|
||||
import com.discordsrv.common.plugin.PluginManager;
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package com.discordsrv.bukkit.config.main;
|
||||
|
||||
import com.discordsrv.common.config.annotation.Order;
|
||||
import com.discordsrv.common.config.configurate.annotation.Order;
|
||||
import com.discordsrv.common.config.main.MainConfig;
|
||||
import com.discordsrv.common.config.main.PluginIntegrationConfig;
|
||||
import com.discordsrv.common.config.main.channels.base.BaseChannelConfig;
|
||||
|
@ -20,7 +20,7 @@ package com.discordsrv.bukkit.config.manager;
|
||||
|
||||
import com.discordsrv.bukkit.config.main.BukkitConfig;
|
||||
import com.discordsrv.common.DiscordSRV;
|
||||
import com.discordsrv.common.config.manager.manager.ServerConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.managers.ServerConfigManager;
|
||||
|
||||
public class BukkitConfigManager extends ServerConfigManager<BukkitConfig> {
|
||||
|
||||
|
@ -20,7 +20,7 @@ package com.discordsrv.bukkit.config.manager;
|
||||
|
||||
import com.discordsrv.bukkit.config.connection.BukkitConnectionConfig;
|
||||
import com.discordsrv.common.DiscordSRV;
|
||||
import com.discordsrv.common.config.manager.ConnectionConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
|
||||
|
||||
public class BukkitConnectionConfigManager extends ConnectionConfigManager<BukkitConnectionConfig> {
|
||||
|
||||
|
@ -26,8 +26,8 @@ import com.discordsrv.common.ProxyDiscordSRV;
|
||||
import com.discordsrv.common.command.game.handler.ICommandHandler;
|
||||
import com.discordsrv.common.config.connection.ConnectionConfig;
|
||||
import com.discordsrv.common.config.main.MainConfig;
|
||||
import com.discordsrv.common.config.manager.ConnectionConfigManager;
|
||||
import com.discordsrv.common.config.manager.MainConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
|
||||
import com.discordsrv.common.debug.data.OnlineMode;
|
||||
import com.discordsrv.common.plugin.PluginManager;
|
||||
import com.discordsrv.common.scheduler.StandardScheduler;
|
||||
|
@ -37,8 +37,8 @@ import com.discordsrv.common.config.connection.ConnectionConfig;
|
||||
import com.discordsrv.common.config.connection.UpdateConfig;
|
||||
import com.discordsrv.common.config.main.MainConfig;
|
||||
import com.discordsrv.common.config.main.linking.LinkedAccountConfig;
|
||||
import com.discordsrv.common.config.manager.ConnectionConfigManager;
|
||||
import com.discordsrv.common.config.manager.MainConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
|
||||
import com.discordsrv.common.debug.data.VersionInfo;
|
||||
import com.discordsrv.common.dependency.DiscordSRVDependencyManager;
|
||||
import com.discordsrv.common.discord.api.DiscordAPIEventModule;
|
||||
|
@ -28,8 +28,8 @@ import com.discordsrv.common.command.game.handler.ICommandHandler;
|
||||
import com.discordsrv.common.component.ComponentFactory;
|
||||
import com.discordsrv.common.config.connection.ConnectionConfig;
|
||||
import com.discordsrv.common.config.main.MainConfig;
|
||||
import com.discordsrv.common.config.manager.ConnectionConfigManager;
|
||||
import com.discordsrv.common.config.manager.MainConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
|
||||
import com.discordsrv.common.console.Console;
|
||||
import com.discordsrv.common.debug.data.OnlineMode;
|
||||
import com.discordsrv.common.debug.data.VersionInfo;
|
||||
|
@ -29,7 +29,7 @@ import com.discordsrv.common.config.main.channels.base.ChannelConfig;
|
||||
import com.discordsrv.common.config.main.channels.base.IChannelConfig;
|
||||
import com.discordsrv.common.config.main.generic.ThreadConfig;
|
||||
import com.discordsrv.common.config.main.generic.DestinationConfig;
|
||||
import com.discordsrv.common.config.manager.MainConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
|
||||
import com.github.benmanes.caffeine.cache.CacheLoader;
|
||||
import com.github.benmanes.caffeine.cache.LoadingCache;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@ -85,14 +85,14 @@ public class ChannelConfigHelper {
|
||||
throws SerializationException {
|
||||
MainConfigManager<?> configManager = discordSRV.configManager();
|
||||
|
||||
CommentedConfigurationNode defaultNode = CommentedConfigurationNode.root(configManager.configNodeOptions());
|
||||
CommentedConfigurationNode target = CommentedConfigurationNode.root(configManager.configNodeOptions());
|
||||
CommentedConfigurationNode defaultNode = CommentedConfigurationNode.root(configManager.nodeOptions());
|
||||
CommentedConfigurationNode target = CommentedConfigurationNode.root(configManager.nodeOptions());
|
||||
|
||||
configManager.configObjectMapper()
|
||||
configManager.objectMapper()
|
||||
.get((Class<BaseChannelConfig>) defaultConfig.getClass())
|
||||
.save(defaultConfig, defaultNode);
|
||||
|
||||
ObjectMapper<BaseChannelConfig> mapper = configManager.configObjectMapper()
|
||||
ObjectMapper<BaseChannelConfig> mapper = configManager.objectMapper()
|
||||
.get((Class<BaseChannelConfig>) config.getClass());
|
||||
|
||||
mapper.save(config, target);
|
||||
|
@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.discordsrv.common.config.annotation;
|
||||
package com.discordsrv.common.config.configurate.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.discordsrv.common.config.annotation;
|
||||
package com.discordsrv.common.config.configurate.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.discordsrv.common.config.annotation;
|
||||
package com.discordsrv.common.config.configurate.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.discordsrv.common.config.fielddiscoverer;
|
||||
package com.discordsrv.common.config.configurate.fielddiscoverer;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.spongepowered.configurate.objectmapping.FieldData;
|
||||
@ -30,6 +30,10 @@ import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Proxy for {@link com.discordsrv.common.config.configurate.annotation.Order}.
|
||||
* @param <T> T of proxied {@link FieldDiscoverer}
|
||||
*/
|
||||
public class OrderedFieldDiscovererProxy<T> implements FieldDiscoverer<T> {
|
||||
|
||||
private final FieldDiscoverer<T> fieldDiscoverer;
|
@ -16,12 +16,12 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.discordsrv.common.config.manager;
|
||||
package com.discordsrv.common.config.configurate.manager;
|
||||
|
||||
import com.discordsrv.common.DiscordSRV;
|
||||
import com.discordsrv.common.config.configurate.manager.loader.YamlConfigLoaderProvider;
|
||||
import com.discordsrv.common.config.connection.ConnectionConfig;
|
||||
import com.discordsrv.common.config.manager.loader.YamlConfigLoaderProvider;
|
||||
import com.discordsrv.common.config.manager.manager.TranslatedConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.managers.TranslatedConfigManager;
|
||||
import org.spongepowered.configurate.ConfigurationOptions;
|
||||
import org.spongepowered.configurate.objectmapping.ObjectMapper;
|
||||
import org.spongepowered.configurate.yaml.YamlConfigurationLoader;
|
||||
@ -35,8 +35,8 @@ public abstract class ConnectionConfigManager<C extends ConnectionConfig>
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationOptions defaultOptions(ObjectMapper.Factory objectMapper) {
|
||||
return super.defaultOptions(objectMapper)
|
||||
public ConfigurationOptions configurationOptions(ObjectMapper.Factory objectMapper) {
|
||||
return super.configurationOptions(objectMapper)
|
||||
.header(ConnectionConfig.HEADER);
|
||||
}
|
||||
|
@ -16,12 +16,12 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.discordsrv.common.config.manager;
|
||||
package com.discordsrv.common.config.configurate.manager;
|
||||
|
||||
import com.discordsrv.common.DiscordSRV;
|
||||
import com.discordsrv.common.config.configurate.manager.loader.YamlConfigLoaderProvider;
|
||||
import com.discordsrv.common.config.main.MainConfig;
|
||||
import com.discordsrv.common.config.manager.loader.YamlConfigLoaderProvider;
|
||||
import com.discordsrv.common.config.manager.manager.TranslatedConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.managers.TranslatedConfigManager;
|
||||
import org.spongepowered.configurate.ConfigurationOptions;
|
||||
import org.spongepowered.configurate.objectmapping.ObjectMapper;
|
||||
import org.spongepowered.configurate.yaml.YamlConfigurationLoader;
|
||||
@ -35,8 +35,8 @@ public abstract class MainConfigManager<C extends MainConfig>
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationOptions defaultOptions(ObjectMapper.Factory objectMapper) {
|
||||
return super.defaultOptions(objectMapper)
|
||||
public ConfigurationOptions configurationOptions(ObjectMapper.Factory objectMapper) {
|
||||
return super.configurationOptions(objectMapper)
|
||||
.header(MainConfig.HEADER);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.discordsrv.common.config.manager.loader;
|
||||
package com.discordsrv.common.config.configurate.manager.loader;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.spongepowered.configurate.CommentedConfigurationNode;
|
@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.discordsrv.common.config.manager.loader;
|
||||
package com.discordsrv.common.config.configurate.manager.loader;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.spongepowered.configurate.loader.AbstractConfigurationLoader;
|
@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.discordsrv.common.config.manager.manager;
|
||||
package com.discordsrv.common.config.configurate.manager.managers;
|
||||
|
||||
import com.discordsrv.common.exception.ConfigException;
|
||||
|
@ -16,23 +16,23 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.discordsrv.common.config.manager.manager;
|
||||
package com.discordsrv.common.config.configurate.manager.managers;
|
||||
|
||||
import com.discordsrv.api.color.Color;
|
||||
import com.discordsrv.api.discord.entity.message.DiscordMessageEmbed;
|
||||
import com.discordsrv.api.discord.entity.message.SendableDiscordMessage;
|
||||
import com.discordsrv.common.DiscordSRV;
|
||||
import com.discordsrv.common.config.annotation.DefaultOnly;
|
||||
import com.discordsrv.common.config.annotation.Order;
|
||||
import com.discordsrv.common.config.fielddiscoverer.OrderedFieldDiscovererProxy;
|
||||
import com.discordsrv.common.config.configurate.annotation.DefaultOnly;
|
||||
import com.discordsrv.common.config.configurate.annotation.Order;
|
||||
import com.discordsrv.common.config.configurate.fielddiscoverer.OrderedFieldDiscovererProxy;
|
||||
import com.discordsrv.common.config.main.channels.base.BaseChannelConfig;
|
||||
import com.discordsrv.common.config.main.channels.base.ChannelConfig;
|
||||
import com.discordsrv.common.config.main.channels.base.IChannelConfig;
|
||||
import com.discordsrv.common.config.manager.loader.ConfigLoaderProvider;
|
||||
import com.discordsrv.common.config.serializer.ColorSerializer;
|
||||
import com.discordsrv.common.config.serializer.DiscordMessageEmbedSerializer;
|
||||
import com.discordsrv.common.config.serializer.PatternSerializer;
|
||||
import com.discordsrv.common.config.serializer.SendableDiscordMessageSerializer;
|
||||
import com.discordsrv.common.config.configurate.manager.loader.ConfigLoaderProvider;
|
||||
import com.discordsrv.common.config.configurate.serializer.ColorSerializer;
|
||||
import com.discordsrv.common.config.configurate.serializer.DiscordMessageEmbedSerializer;
|
||||
import com.discordsrv.common.config.configurate.serializer.PatternSerializer;
|
||||
import com.discordsrv.common.config.configurate.serializer.SendableDiscordMessageSerializer;
|
||||
import com.discordsrv.common.exception.ConfigException;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.configurate.*;
|
||||
@ -70,8 +70,8 @@ public abstract class ConfigurateConfigManager<T, LT extends AbstractConfigurati
|
||||
|
||||
protected final DiscordSRV discordSRV;
|
||||
private final Path filePath;
|
||||
private final ObjectMapper.Factory configObjectMapper;
|
||||
private final ObjectMapper.Factory defaultObjectMapper;
|
||||
private final ObjectMapper.Factory objectMapper;
|
||||
private final ObjectMapper.Factory cleanObjectMapper;
|
||||
private final LT loader;
|
||||
|
||||
protected T configuration;
|
||||
@ -79,9 +79,9 @@ public abstract class ConfigurateConfigManager<T, LT extends AbstractConfigurati
|
||||
public ConfigurateConfigManager(DiscordSRV discordSRV) {
|
||||
this.discordSRV = discordSRV;
|
||||
this.filePath = discordSRV.dataDirectory().resolve(fileName());
|
||||
this.configObjectMapper = configObjectMapperBuilder().build();
|
||||
this.defaultObjectMapper = defaultObjectMapperBuilder().build();
|
||||
this.loader = createLoader(filePath, configNodeOptions());
|
||||
this.objectMapper = objectMapperBuilder().build();
|
||||
this.cleanObjectMapper = cleanObjectMapperBuilder().build();
|
||||
this.loader = createLoader(filePath, nodeOptions());
|
||||
}
|
||||
|
||||
public Path filePath() {
|
||||
@ -103,7 +103,7 @@ public abstract class ConfigurateConfigManager<T, LT extends AbstractConfigurati
|
||||
return new IChannelConfig.Serializer(mapperFactory, BaseChannelConfig.class, ChannelConfig.class);
|
||||
}
|
||||
|
||||
public ConfigurationOptions defaultOptions(ObjectMapper.Factory objectMapper) {
|
||||
public ConfigurationOptions configurationOptions(ObjectMapper.Factory objectMapper) {
|
||||
return ConfigurationOptions.defaults()
|
||||
.shouldCopyDefaults(false)
|
||||
.implicitInitialization(false)
|
||||
@ -145,16 +145,16 @@ public abstract class ConfigurateConfigManager<T, LT extends AbstractConfigurati
|
||||
});
|
||||
}
|
||||
|
||||
public ConfigurationOptions configNodeOptions() {
|
||||
return defaultOptions(configObjectMapper());
|
||||
public ConfigurationOptions nodeOptions() {
|
||||
return configurationOptions(objectMapper());
|
||||
}
|
||||
|
||||
public ConfigurationOptions defaultNodeOptions() {
|
||||
return defaultOptions(defaultObjectMapper());
|
||||
public ConfigurationOptions cleanNodeOptions() {
|
||||
return configurationOptions(cleanObjectMapper());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ObjectMapper.Factory.Builder objectMapperBuilder() {
|
||||
public ObjectMapper.Factory.Builder commonObjectMapperBuilder() {
|
||||
Comparator<OrderedFieldDiscovererProxy.FieldCollectorData<Object, ?>> fieldOrder = Comparator.comparingInt(data -> {
|
||||
Order order = data.annotations().getAnnotation(Order.class);
|
||||
return order != null ? order.value() : 0;
|
||||
@ -180,12 +180,12 @@ public abstract class ConfigurateConfigManager<T, LT extends AbstractConfigurati
|
||||
.addDiscoverer(new OrderedFieldDiscovererProxy<>((FieldDiscoverer<Object>) FieldDiscoverer.record(), fieldOrder));
|
||||
}
|
||||
|
||||
public ObjectMapper.Factory.Builder configObjectMapperBuilder() {
|
||||
return objectMapperBuilder();
|
||||
public ObjectMapper.Factory.Builder objectMapperBuilder() {
|
||||
return commonObjectMapperBuilder();
|
||||
}
|
||||
|
||||
protected ObjectMapper.Factory.Builder defaultObjectMapperBuilder() {
|
||||
return objectMapperBuilder()
|
||||
protected ObjectMapper.Factory.Builder cleanObjectMapperBuilder() {
|
||||
return commonObjectMapperBuilder()
|
||||
.addProcessor(DefaultOnly.class, (data, value) -> (value1, destination) -> {
|
||||
String[] children = data.value();
|
||||
boolean whitelist = data.whitelist();
|
||||
@ -219,20 +219,27 @@ public abstract class ConfigurateConfigManager<T, LT extends AbstractConfigurati
|
||||
});
|
||||
}
|
||||
|
||||
public ObjectMapper.Factory configObjectMapper() {
|
||||
return configObjectMapper;
|
||||
public ObjectMapper.Factory objectMapper() {
|
||||
return objectMapper;
|
||||
}
|
||||
|
||||
public ObjectMapper.Factory defaultObjectMapper() {
|
||||
return defaultObjectMapper;
|
||||
public ObjectMapper.Factory cleanObjectMapper() {
|
||||
return cleanObjectMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default config given the default object from {@link #createConfiguration()}
|
||||
* @param defaultConfig the object
|
||||
* @param cleanMapper if options that are marked with {@link DefaultOnly} or serializers that make use of {@link #CLEAN_MAPPER} should be excluded from the node
|
||||
* @return the node with the values from the object
|
||||
* @throws SerializationException if serialization fails
|
||||
*/
|
||||
private CommentedConfigurationNode getDefault(T defaultConfig, boolean cleanMapper) throws SerializationException {
|
||||
try {
|
||||
if (cleanMapper) {
|
||||
CLEAN_MAPPER.set(true);
|
||||
}
|
||||
return getDefault(defaultConfig, cleanMapper ? defaultObjectMapper() : configObjectMapper());
|
||||
return getDefault(defaultConfig, cleanMapper ? cleanObjectMapper() : objectMapper());
|
||||
} finally {
|
||||
if (cleanMapper) {
|
||||
CLEAN_MAPPER.set(false);
|
||||
@ -240,9 +247,13 @@ public abstract class ConfigurateConfigManager<T, LT extends AbstractConfigurati
|
||||
}
|
||||
}
|
||||
|
||||
public CommentedConfigurationNode getDefaultNode(ObjectMapper.Factory mapperFactory) throws ConfigurateException {
|
||||
return getDefault(createConfiguration(), mapperFactory);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private CommentedConfigurationNode getDefault(T defaultConfig, ObjectMapper.Factory mapperFactory) throws SerializationException {
|
||||
CommentedConfigurationNode node = CommentedConfigurationNode.root(defaultNodeOptions());
|
||||
CommentedConfigurationNode node = CommentedConfigurationNode.root(cleanNodeOptions());
|
||||
mapperFactory.get((Class<T>) defaultConfig.getClass()).save(defaultConfig, node);
|
||||
return node;
|
||||
}
|
||||
@ -252,10 +263,6 @@ public abstract class ConfigurateConfigManager<T, LT extends AbstractConfigurati
|
||||
return null;
|
||||
}
|
||||
|
||||
public CommentedConfigurationNode getDefaultNode(ObjectMapper.Factory mapperFactory) throws ConfigurateException {
|
||||
return getDefault(createConfiguration(), mapperFactory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() throws ConfigException {
|
||||
reload();
|
||||
@ -284,7 +291,7 @@ public abstract class ConfigurateConfigManager<T, LT extends AbstractConfigurati
|
||||
node = getDefault(defaultConfig, false);
|
||||
}
|
||||
|
||||
this.configuration = configObjectMapper()
|
||||
this.configuration = objectMapper()
|
||||
.get((Class<T>) defaultConfig.getClass())
|
||||
.load(node);
|
||||
} catch (ConfigurateException e) {
|
||||
@ -312,6 +319,6 @@ public abstract class ConfigurateConfigManager<T, LT extends AbstractConfigurati
|
||||
}
|
||||
|
||||
protected void save(T config, Class<T> clazz, CommentedConfigurationNode node) throws SerializationException {
|
||||
configObjectMapper().get(clazz).save(config, node);
|
||||
objectMapper().get(clazz).save(config, node);
|
||||
}
|
||||
}
|
@ -16,14 +16,14 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.discordsrv.common.config.manager.manager;
|
||||
package com.discordsrv.common.config.configurate.manager.managers;
|
||||
|
||||
import com.discordsrv.common.DiscordSRV;
|
||||
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
|
||||
import com.discordsrv.common.config.main.MainConfig;
|
||||
import com.discordsrv.common.config.main.channels.base.IChannelConfig;
|
||||
import com.discordsrv.common.config.main.channels.base.proxy.ProxyBaseChannelConfig;
|
||||
import com.discordsrv.common.config.main.channels.base.proxy.ProxyChannelConfig;
|
||||
import com.discordsrv.common.config.manager.MainConfigManager;
|
||||
import org.spongepowered.configurate.objectmapping.ObjectMapper;
|
||||
|
||||
public abstract class ProxyConfigManager<T extends MainConfig> extends MainConfigManager<T> {
|
@ -16,14 +16,14 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.discordsrv.common.config.manager.manager;
|
||||
package com.discordsrv.common.config.configurate.manager.managers;
|
||||
|
||||
import com.discordsrv.common.DiscordSRV;
|
||||
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
|
||||
import com.discordsrv.common.config.main.MainConfig;
|
||||
import com.discordsrv.common.config.main.channels.base.IChannelConfig;
|
||||
import com.discordsrv.common.config.main.channels.base.server.ServerBaseChannelConfig;
|
||||
import com.discordsrv.common.config.main.channels.base.server.ServerChannelConfig;
|
||||
import com.discordsrv.common.config.manager.MainConfigManager;
|
||||
import org.spongepowered.configurate.objectmapping.ObjectMapper;
|
||||
|
||||
public abstract class ServerConfigManager<T extends MainConfig> extends MainConfigManager<T> {
|
@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.discordsrv.common.config.manager.manager;
|
||||
package com.discordsrv.common.config.configurate.manager.managers;
|
||||
|
||||
import com.discordsrv.common.DiscordSRV;
|
||||
import com.discordsrv.common.config.Config;
|
||||
@ -53,8 +53,8 @@ public abstract class TranslatedConfigManager<T extends Config, LT extends Abstr
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationOptions defaultOptions(ObjectMapper.Factory objectMapper) {
|
||||
ConfigurationOptions options = super.defaultOptions(objectMapper);
|
||||
public ConfigurationOptions configurationOptions(ObjectMapper.Factory objectMapper) {
|
||||
ConfigurationOptions options = super.configurationOptions(objectMapper);
|
||||
if (header != null) {
|
||||
options = options.header(header);
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.discordsrv.common.config.serializer;
|
||||
package com.discordsrv.common.config.configurate.serializer;
|
||||
|
||||
import com.discordsrv.api.color.Color;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
@ -16,11 +16,11 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.discordsrv.common.config.serializer;
|
||||
package com.discordsrv.common.config.configurate.serializer;
|
||||
|
||||
import com.discordsrv.api.color.Color;
|
||||
import com.discordsrv.api.discord.entity.message.DiscordMessageEmbed;
|
||||
import com.discordsrv.common.config.manager.manager.ConfigurateConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.managers.ConfigurateConfigManager;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.spongepowered.configurate.ConfigurationNode;
|
@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.discordsrv.common.config.serializer;
|
||||
package com.discordsrv.common.config.configurate.serializer;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.spongepowered.configurate.ConfigurationNode;
|
@ -16,11 +16,11 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.discordsrv.common.config.serializer;
|
||||
package com.discordsrv.common.config.configurate.serializer;
|
||||
|
||||
import com.discordsrv.api.discord.entity.message.DiscordMessageEmbed;
|
||||
import com.discordsrv.api.discord.entity.message.SendableDiscordMessage;
|
||||
import com.discordsrv.common.config.manager.manager.ConfigurateConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.managers.ConfigurateConfigManager;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.spongepowered.configurate.ConfigurationNode;
|
||||
import org.spongepowered.configurate.serialize.SerializationException;
|
@ -1,6 +1,6 @@
|
||||
package com.discordsrv.common.config.main;
|
||||
|
||||
import com.discordsrv.common.config.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.configurate.annotation.Untranslated;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
import org.spongepowered.configurate.objectmapping.meta.Comment;
|
||||
|
||||
|
@ -20,8 +20,8 @@ package com.discordsrv.common.config.main;
|
||||
|
||||
import com.discordsrv.api.channel.GameChannel;
|
||||
import com.discordsrv.common.config.Config;
|
||||
import com.discordsrv.common.config.annotation.DefaultOnly;
|
||||
import com.discordsrv.common.config.annotation.Order;
|
||||
import com.discordsrv.common.config.configurate.annotation.DefaultOnly;
|
||||
import com.discordsrv.common.config.configurate.annotation.Order;
|
||||
import com.discordsrv.common.config.connection.ConnectionConfig;
|
||||
import com.discordsrv.common.config.main.channels.base.BaseChannelConfig;
|
||||
import com.discordsrv.common.config.main.channels.base.ChannelConfig;
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package com.discordsrv.common.config.main.channels;
|
||||
|
||||
import com.discordsrv.common.config.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.configurate.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.main.generic.DiscordIgnoresConfig;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
import org.spongepowered.configurate.objectmapping.meta.Comment;
|
||||
|
@ -21,7 +21,7 @@ package com.discordsrv.common.config.main.channels;
|
||||
import com.discordsrv.api.discord.entity.message.DiscordMessageEmbed;
|
||||
import com.discordsrv.api.discord.entity.message.SendableDiscordMessage;
|
||||
import com.discordsrv.api.event.events.message.receive.game.JoinMessageReceiveEvent;
|
||||
import com.discordsrv.common.config.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.configurate.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.main.generic.IMessageConfig;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
|
@ -20,7 +20,7 @@ package com.discordsrv.common.config.main.channels;
|
||||
|
||||
import com.discordsrv.api.discord.entity.message.DiscordMessageEmbed;
|
||||
import com.discordsrv.api.discord.entity.message.SendableDiscordMessage;
|
||||
import com.discordsrv.common.config.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.configurate.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.main.generic.IMessageConfig;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
|
||||
|
@ -19,8 +19,8 @@
|
||||
package com.discordsrv.common.config.main.channels;
|
||||
|
||||
import com.discordsrv.api.discord.entity.message.SendableDiscordMessage;
|
||||
import com.discordsrv.common.config.annotation.DefaultOnly;
|
||||
import com.discordsrv.common.config.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.configurate.annotation.DefaultOnly;
|
||||
import com.discordsrv.common.config.configurate.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.main.generic.IMessageConfig;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
import org.spongepowered.configurate.objectmapping.meta.Comment;
|
||||
|
@ -19,7 +19,7 @@
|
||||
package com.discordsrv.common.config.main.channels;
|
||||
|
||||
import com.discordsrv.api.discord.entity.message.SendableDiscordMessage;
|
||||
import com.discordsrv.common.config.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.configurate.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.main.generic.IMessageConfig;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
package com.discordsrv.common.config.main.channels;
|
||||
|
||||
import com.discordsrv.api.discord.entity.message.SendableDiscordMessage;
|
||||
import com.discordsrv.common.config.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.configurate.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.main.generic.IMessageConfig;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
|
||||
|
@ -18,8 +18,7 @@
|
||||
|
||||
package com.discordsrv.common.config.main.channels.base;
|
||||
|
||||
import com.discordsrv.common.config.annotation.Order;
|
||||
import com.discordsrv.common.config.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.configurate.annotation.Order;
|
||||
import com.discordsrv.common.config.main.channels.*;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
import org.spongepowered.configurate.objectmapping.meta.Comment;
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package com.discordsrv.common.config.main.channels.base.proxy;
|
||||
|
||||
import com.discordsrv.common.config.annotation.Order;
|
||||
import com.discordsrv.common.config.configurate.annotation.Order;
|
||||
import com.discordsrv.common.config.main.channels.JoinMessageConfig;
|
||||
import com.discordsrv.common.config.main.channels.proxy.ServerSwitchMessageConfig;
|
||||
import com.discordsrv.common.config.main.channels.base.BaseChannelConfig;
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package com.discordsrv.common.config.main.channels.base.server;
|
||||
|
||||
import com.discordsrv.common.config.annotation.Order;
|
||||
import com.discordsrv.common.config.configurate.annotation.Order;
|
||||
import com.discordsrv.common.config.main.channels.server.AwardMessageConfig;
|
||||
import com.discordsrv.common.config.main.channels.server.DeathMessageConfig;
|
||||
import com.discordsrv.common.config.main.channels.base.BaseChannelConfig;
|
||||
|
@ -20,7 +20,7 @@ package com.discordsrv.common.config.main.channels.proxy;
|
||||
|
||||
import com.discordsrv.api.discord.entity.message.DiscordMessageEmbed;
|
||||
import com.discordsrv.api.discord.entity.message.SendableDiscordMessage;
|
||||
import com.discordsrv.common.config.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.configurate.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.main.generic.IMessageConfig;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
|
||||
|
@ -20,7 +20,7 @@ package com.discordsrv.common.config.main.channels.server;
|
||||
|
||||
import com.discordsrv.api.discord.entity.message.DiscordMessageEmbed;
|
||||
import com.discordsrv.api.discord.entity.message.SendableDiscordMessage;
|
||||
import com.discordsrv.common.config.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.configurate.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.main.generic.IMessageConfig;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
|
||||
|
@ -20,7 +20,7 @@ package com.discordsrv.common.config.main.channels.server;
|
||||
|
||||
import com.discordsrv.api.discord.entity.message.DiscordMessageEmbed;
|
||||
import com.discordsrv.api.discord.entity.message.SendableDiscordMessage;
|
||||
import com.discordsrv.common.config.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.configurate.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.main.generic.IMessageConfig;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package com.discordsrv.common.config.main.channels.server;
|
||||
|
||||
import com.discordsrv.common.config.annotation.Order;
|
||||
import com.discordsrv.common.config.configurate.annotation.Order;
|
||||
import com.discordsrv.common.config.main.channels.JoinMessageConfig;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package com.discordsrv.common.config.main.linking;
|
||||
|
||||
import com.discordsrv.common.config.annotation.Order;
|
||||
import com.discordsrv.common.config.configurate.annotation.Order;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
|
||||
@ConfigSerializable
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package com.discordsrv.common.config.main.linking;
|
||||
|
||||
import com.discordsrv.common.config.annotation.DefaultOnly;
|
||||
import com.discordsrv.common.config.configurate.annotation.DefaultOnly;
|
||||
import com.discordsrv.common.config.connection.ConnectionConfig;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
import org.spongepowered.configurate.objectmapping.meta.Comment;
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package com.discordsrv.common.config.main.linking;
|
||||
|
||||
import com.discordsrv.common.config.annotation.Order;
|
||||
import com.discordsrv.common.config.configurate.annotation.Order;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
import org.spongepowered.configurate.objectmapping.meta.Comment;
|
||||
import org.spongepowered.configurate.objectmapping.meta.Setting;
|
||||
|
@ -24,9 +24,9 @@ import com.discordsrv.common.command.game.handler.ICommandHandler;
|
||||
import com.discordsrv.common.config.connection.ConnectionConfig;
|
||||
import com.discordsrv.common.config.main.MainConfig;
|
||||
import com.discordsrv.common.config.main.PluginIntegrationConfig;
|
||||
import com.discordsrv.common.config.manager.ConnectionConfigManager;
|
||||
import com.discordsrv.common.config.manager.MainConfigManager;
|
||||
import com.discordsrv.common.config.manager.manager.ServerConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.managers.ServerConfigManager;
|
||||
import com.discordsrv.common.console.Console;
|
||||
import com.discordsrv.common.debug.data.OnlineMode;
|
||||
import com.discordsrv.common.logging.Logger;
|
||||
|
@ -22,9 +22,9 @@ import com.discordsrv.bukkit.config.manager.BukkitConfigManager;
|
||||
import com.discordsrv.bukkit.config.manager.BukkitConnectionConfigManager;
|
||||
import com.discordsrv.common.DiscordSRV;
|
||||
import com.discordsrv.common.config.Config;
|
||||
import com.discordsrv.common.config.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.manager.manager.ConfigurateConfigManager;
|
||||
import com.discordsrv.common.config.manager.manager.TranslatedConfigManager;
|
||||
import com.discordsrv.common.config.configurate.annotation.Untranslated;
|
||||
import com.discordsrv.common.config.configurate.manager.managers.ConfigurateConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.managers.TranslatedConfigManager;
|
||||
import org.spongepowered.configurate.CommentedConfigurationNode;
|
||||
import org.spongepowered.configurate.ConfigurateException;
|
||||
import org.spongepowered.configurate.ConfigurationNode;
|
||||
@ -82,12 +82,12 @@ public final class DiscordSRVTranslation {
|
||||
String fileIdentifier = config.getFileName();
|
||||
ConfigurationNode commentSection = node.node(fileIdentifier + "_comments");
|
||||
|
||||
String header = configManager.configNodeOptions().header();
|
||||
String header = configManager.nodeOptions().header();
|
||||
if (header != null) {
|
||||
commentSection.node("$header").set(header);
|
||||
}
|
||||
|
||||
ObjectMapper.Factory mapperFactory = configManager.configObjectMapperBuilder()
|
||||
ObjectMapper.Factory mapperFactory = configManager.objectMapperBuilder()
|
||||
.addProcessor(Untranslated.class, untranslatedProcessorFactory)
|
||||
.build();
|
||||
|
||||
|
@ -24,8 +24,8 @@ import com.discordsrv.common.bootstrap.LifecycleManager;
|
||||
import com.discordsrv.common.command.game.handler.ICommandHandler;
|
||||
import com.discordsrv.common.config.connection.ConnectionConfig;
|
||||
import com.discordsrv.common.config.main.MainConfig;
|
||||
import com.discordsrv.common.config.manager.ConnectionConfigManager;
|
||||
import com.discordsrv.common.config.manager.MainConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
|
||||
import com.discordsrv.common.console.Console;
|
||||
import com.discordsrv.common.debug.data.OnlineMode;
|
||||
import com.discordsrv.common.logging.Logger;
|
||||
|
@ -19,8 +19,8 @@
|
||||
package com.discordsrv.config;
|
||||
|
||||
import com.discordsrv.common.DiscordSRV;
|
||||
import com.discordsrv.common.config.manager.loader.YamlConfigLoaderProvider;
|
||||
import com.discordsrv.common.config.manager.manager.ConfigurateConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.loader.YamlConfigLoaderProvider;
|
||||
import com.discordsrv.common.config.configurate.manager.managers.ConfigurateConfigManager;
|
||||
import org.spongepowered.configurate.objectmapping.ObjectMapper;
|
||||
import org.spongepowered.configurate.yaml.YamlConfigurationLoader;
|
||||
|
||||
@ -38,13 +38,13 @@ public class TranslationConfigManagerProxy<C>
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectMapper.Factory configObjectMapper() {
|
||||
return objectMapper != null ? objectMapper : super.configObjectMapper();
|
||||
public ObjectMapper.Factory objectMapper() {
|
||||
return objectMapper != null ? objectMapper : super.objectMapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectMapper.Factory defaultObjectMapper() {
|
||||
return objectMapper != null ? objectMapper : super.defaultObjectMapper();
|
||||
public ObjectMapper.Factory cleanObjectMapper() {
|
||||
return objectMapper != null ? objectMapper : super.cleanObjectMapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,8 +23,8 @@ import com.discordsrv.common.ServerDiscordSRV;
|
||||
import com.discordsrv.common.command.game.handler.ICommandHandler;
|
||||
import com.discordsrv.common.config.connection.ConnectionConfig;
|
||||
import com.discordsrv.common.config.main.MainConfig;
|
||||
import com.discordsrv.common.config.manager.ConnectionConfigManager;
|
||||
import com.discordsrv.common.config.manager.MainConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
|
||||
import com.discordsrv.common.debug.data.OnlineMode;
|
||||
import com.discordsrv.common.plugin.PluginManager;
|
||||
import com.discordsrv.sponge.console.SpongeConsole;
|
||||
|
@ -22,8 +22,8 @@ import com.discordsrv.common.ProxyDiscordSRV;
|
||||
import com.discordsrv.common.command.game.handler.ICommandHandler;
|
||||
import com.discordsrv.common.config.connection.ConnectionConfig;
|
||||
import com.discordsrv.common.config.main.MainConfig;
|
||||
import com.discordsrv.common.config.manager.ConnectionConfigManager;
|
||||
import com.discordsrv.common.config.manager.MainConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
|
||||
import com.discordsrv.common.debug.data.OnlineMode;
|
||||
import com.discordsrv.common.plugin.PluginManager;
|
||||
import com.discordsrv.common.scheduler.StandardScheduler;
|
||||
|
Loading…
Reference in New Issue
Block a user