Merge messages-config

This commit is contained in:
Vankka 2023-08-26 15:55:51 +03:00
commit 59764117d3
No known key found for this signature in database
GPG Key ID: 6E50CB7A29B96AD0
22 changed files with 319 additions and 22 deletions

View File

@ -40,6 +40,6 @@ jobs:
project_id: ${{ secrets.CROWDIN_PROJECT_ID }}
token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
source: "i18n/build/source.yaml"
translation: "/i18n/src/main/resources/translations/%three_letters_code%.%file_extension%"
translation: "/i18n/src/main/resources/translations/%two_letters_code%.%file_extension%"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -32,6 +32,6 @@ jobs:
project_id: ${{ secrets.CROWDIN_PROJECT_ID }}
token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
source: "i18n/build/source.yaml"
translation: "/i18n/src/main/resources/translations/%three_letters_code%.%file_extension%"
translation: "/i18n/src/main/resources/translations/%two_letters_code%.%file_extension%"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -26,6 +26,7 @@ import com.discordsrv.bukkit.config.connection.BukkitConnectionConfig;
import com.discordsrv.bukkit.config.main.BukkitConfig;
import com.discordsrv.bukkit.config.manager.BukkitConfigManager;
import com.discordsrv.bukkit.config.manager.BukkitConnectionConfigManager;
import com.discordsrv.bukkit.config.manager.BukkitMessagesConfigManager;
import com.discordsrv.bukkit.console.BukkitConsole;
import com.discordsrv.bukkit.listener.BukkitConnectionListener;
import com.discordsrv.bukkit.listener.BukkitDeathListener;
@ -43,6 +44,8 @@ import com.discordsrv.common.ServerDiscordSRV;
import com.discordsrv.common.command.game.handler.ICommandHandler;
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
import com.discordsrv.common.config.configurate.manager.MessagesConfigManager;
import com.discordsrv.common.config.messages.MessagesConfig;
import com.discordsrv.common.debug.data.OnlineMode;
import com.discordsrv.common.messageforwarding.game.minecrafttodiscord.MinecraftToDiscordChatModule;
import com.discordsrv.common.plugin.PluginManager;
@ -56,7 +59,7 @@ import java.lang.reflect.Field;
import java.util.List;
import java.util.Set;
public class BukkitDiscordSRV extends ServerDiscordSRV<DiscordSRVBukkitBootstrap, BukkitConfig, BukkitConnectionConfig> {
public class BukkitDiscordSRV extends ServerDiscordSRV<DiscordSRVBukkitBootstrap, BukkitConfig, BukkitConnectionConfig, MessagesConfig> {
private BukkitAudiences audiences;
private BukkitTranslationLoader translationLoader;
@ -71,6 +74,7 @@ public class BukkitDiscordSRV extends ServerDiscordSRV<DiscordSRVBukkitBootstrap
private final BukkitConnectionConfigManager connectionConfigManager;
private final BukkitConfigManager configManager;
private final BukkitMessagesConfigManager messagesConfigManager;
private static IBukkitScheduler createScheduler(BukkitDiscordSRV discordSRV) {
try {
@ -92,6 +96,7 @@ public class BukkitDiscordSRV extends ServerDiscordSRV<DiscordSRVBukkitBootstrap
// Config
this.connectionConfigManager = new BukkitConnectionConfigManager(this);
this.configManager = new BukkitConfigManager(this);
this.messagesConfigManager = new BukkitMessagesConfigManager(this);
load();
@ -170,6 +175,11 @@ public class BukkitDiscordSRV extends ServerDiscordSRV<DiscordSRVBukkitBootstrap
return configManager;
}
@Override
public MessagesConfigManager<MessagesConfig> messagesConfigManager() {
return messagesConfigManager;
}
@Override
protected void enable() throws Throwable {
// Service provider

View File

@ -0,0 +1,17 @@
package com.discordsrv.bukkit.config.manager;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.config.configurate.manager.MessagesConfigManager;
import com.discordsrv.common.config.messages.MessagesConfig;
public class BukkitMessagesConfigManager extends MessagesConfigManager<MessagesConfig> {
public BukkitMessagesConfigManager(DiscordSRV discordSRV) {
super(discordSRV);
}
@Override
public MessagesConfig createConfiguration() {
return new MessagesConfig();
}
}

View File

@ -24,10 +24,12 @@ import com.discordsrv.bungee.player.BungeePlayerProvider;
import com.discordsrv.bungee.plugin.BungeePluginManager;
import com.discordsrv.common.ProxyDiscordSRV;
import com.discordsrv.common.command.game.handler.ICommandHandler;
import com.discordsrv.common.config.configurate.manager.MessagesConfigManager;
import com.discordsrv.common.config.connection.ConnectionConfig;
import com.discordsrv.common.config.main.MainConfig;
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
import com.discordsrv.common.config.messages.MessagesConfig;
import com.discordsrv.common.debug.data.OnlineMode;
import com.discordsrv.common.plugin.PluginManager;
import com.discordsrv.common.scheduler.StandardScheduler;
@ -36,7 +38,7 @@ import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
public class BungeeDiscordSRV extends ProxyDiscordSRV<DiscordSRVBungeeBootstrap, MainConfig, ConnectionConfig> {
public class BungeeDiscordSRV extends ProxyDiscordSRV<DiscordSRVBungeeBootstrap, MainConfig, ConnectionConfig, MessagesConfig> {
private BungeeAudiences audiences;
@ -109,6 +111,11 @@ public class BungeeDiscordSRV extends ProxyDiscordSRV<DiscordSRVBungeeBootstrap,
return null;
}
@Override
public MessagesConfigManager<MessagesConfig> messagesConfigManager() {
return null;
}
@Override
protected void enable() throws Throwable {
// Player related

View File

@ -33,12 +33,15 @@ import com.discordsrv.common.command.discord.DiscordCommandModule;
import com.discordsrv.common.command.game.GameCommandModule;
import com.discordsrv.common.command.game.commands.subcommand.reload.ReloadResults;
import com.discordsrv.common.component.ComponentFactory;
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
import com.discordsrv.common.config.configurate.manager.MessagesConfigManager;
import com.discordsrv.common.config.configurate.manager.MessagesConfigSingleManager;
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.configurate.manager.ConnectionConfigManager;
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
import com.discordsrv.common.config.messages.MessagesConfig;
import com.discordsrv.common.debug.data.VersionInfo;
import com.discordsrv.common.dependency.DiscordSRVDependencyManager;
import com.discordsrv.common.discord.api.DiscordAPIEventModule;
@ -84,6 +87,7 @@ import okhttp3.ConnectionPool;
import okhttp3.Dispatcher;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import org.apache.commons.lang3.StringUtils;
import org.intellij.lang.annotations.Language;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -110,7 +114,12 @@ import java.util.jar.Manifest;
* @param <C> the config type
* @param <CC> the connections config type
*/
public abstract class AbstractDiscordSRV<B extends IBootstrap, C extends MainConfig, CC extends ConnectionConfig> implements DiscordSRV {
public abstract class AbstractDiscordSRV<
B extends IBootstrap,
C extends MainConfig,
CC extends ConnectionConfig,
MC extends MessagesConfig
> implements DiscordSRV {
private final AtomicReference<Status> status = new AtomicReference<>(Status.INITIALIZED);
private final AtomicReference<Boolean> beenReady = new AtomicReference<>(false);
@ -380,6 +389,21 @@ public abstract class AbstractDiscordSRV<B extends IBootstrap, C extends MainCon
return configManager().config();
}
@Override
public abstract MessagesConfigManager<MC> messagesConfigManager();
@Override
public MC messagesConfig(Locale locale) {
MessagesConfigSingleManager<MC> manager = messagesConfigManager().getManager(locale);
if (manager == null) {
manager = messagesConfigManager().getManager(defaultLocale());
}
if (manager == null) {
manager = messagesConfigManager().getManager(Locale.US);
}
return manager.config();
}
// Module
@Override
@ -430,8 +454,15 @@ public abstract class AbstractDiscordSRV<B extends IBootstrap, C extends MainCon
}
@Override
public Locale locale() {
// TODO: config
public Locale defaultLocale() {
MainConfig config = config();
if (config != null) {
String defaultLanguage = config.messages.defaultLanguage;
if (StringUtils.isNotBlank(defaultLanguage)) {
return Locale.forLanguageTag(defaultLanguage);
}
}
return Locale.getDefault();
}
@ -607,6 +638,7 @@ public abstract class AbstractDiscordSRV<B extends IBootstrap, C extends MainCon
try {
connectionConfigManager().load();
configManager().load();
messagesConfigManager().load();
channelConfig().reload();
} catch (Throwable t) {

View File

@ -26,10 +26,12 @@ import com.discordsrv.common.channel.ChannelConfigHelper;
import com.discordsrv.common.command.game.GameCommandExecutionHelper;
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.configurate.manager.ConnectionConfigManager;
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
import com.discordsrv.common.config.configurate.manager.MessagesConfigManager;
import com.discordsrv.common.config.connection.ConnectionConfig;
import com.discordsrv.common.config.main.MainConfig;
import com.discordsrv.common.config.messages.MessagesConfig;
import com.discordsrv.common.console.Console;
import com.discordsrv.common.debug.data.OnlineMode;
import com.discordsrv.common.debug.data.VersionInfo;
@ -115,6 +117,9 @@ public interface DiscordSRV extends DiscordSRVApi {
ConnectionConfig connectionConfig();
MainConfigManager<? extends MainConfig> configManager();
MainConfig config();
MessagesConfigManager<? extends MessagesConfig> messagesConfigManager();
MessagesConfig messagesConfig(Locale locale);
// Config helper
ChannelConfigHelper channelConfig();
@ -130,7 +135,7 @@ public interface DiscordSRV extends DiscordSRVApi {
void unregisterModule(AbstractModule<?> module);
ModuleManager moduleManager();
Locale locale();
Locale defaultLocale();
// Status
void setStatus(Status status);

View File

@ -21,9 +21,15 @@ package com.discordsrv.common;
import com.discordsrv.common.bootstrap.IBootstrap;
import com.discordsrv.common.config.connection.ConnectionConfig;
import com.discordsrv.common.config.main.MainConfig;
import com.discordsrv.common.config.messages.MessagesConfig;
import com.discordsrv.common.messageforwarding.game.ServerSwitchMessageModule;
public abstract class ProxyDiscordSRV<B extends IBootstrap, C extends MainConfig, CC extends ConnectionConfig> extends AbstractDiscordSRV<B, C, CC> {
public abstract class ProxyDiscordSRV<
B extends IBootstrap,
C extends MainConfig,
CC extends ConnectionConfig,
MC extends MessagesConfig
> extends AbstractDiscordSRV<B, C, CC, MC> {
public ProxyDiscordSRV(B bootstrap) {
super(bootstrap);

View File

@ -21,6 +21,7 @@ package com.discordsrv.common;
import com.discordsrv.common.bootstrap.IBootstrap;
import com.discordsrv.common.config.connection.ConnectionConfig;
import com.discordsrv.common.config.main.MainConfig;
import com.discordsrv.common.config.messages.MessagesConfig;
import com.discordsrv.common.messageforwarding.game.AwardMessageModule;
import com.discordsrv.common.messageforwarding.game.DeathMessageModule;
import com.discordsrv.common.player.ServerPlayerProvider;
@ -30,7 +31,12 @@ import org.jetbrains.annotations.NotNull;
import javax.annotation.OverridingMethodsMustInvokeSuper;
import java.util.concurrent.CompletableFuture;
public abstract class ServerDiscordSRV<B extends IBootstrap, C extends MainConfig, CC extends ConnectionConfig> extends AbstractDiscordSRV<B, C, CC> {
public abstract class ServerDiscordSRV<
B extends IBootstrap,
C extends MainConfig,
CC extends ConnectionConfig,
MC extends MessagesConfig
> extends AbstractDiscordSRV<B, C, CC, MC> {
public ServerDiscordSRV(B bootstrap) {
super(bootstrap);

View File

@ -0,0 +1,91 @@
package com.discordsrv.common.config.configurate.manager;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.config.main.MainConfig;
import com.discordsrv.common.config.messages.MessagesConfig;
import com.discordsrv.common.exception.ConfigException;
import com.discordsrv.common.logging.Logger;
import com.discordsrv.common.logging.NamedLogger;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.stream.Stream;
public abstract class MessagesConfigManager<C extends MessagesConfig> {
private final Map<Locale, MessagesConfigSingleManager<C>> configs = new LinkedHashMap<>();
private final DiscordSRV discordSRV;
private final Logger logger;
public MessagesConfigManager(DiscordSRV discordSRV) {
this.discordSRV = discordSRV;
this.logger = new NamedLogger(discordSRV, "MESSAGES_CONFIG");
}
public abstract C createConfiguration();
public MessagesConfigSingleManager<C> getManager(Locale locale) {
synchronized (configs) {
return configs.get(locale);
}
}
public Path directory() {
return discordSRV.dataDirectory().resolve("messages");
}
public void load() throws ConfigException {
synchronized (configs) {
configs.clear();
MainConfig config = discordSRV.config();
if (config == null) {
throw new ConfigException("MainConfig not available");
}
if (config.messages.multiple) {
try {
Path messagesDirectory = directory();
if (!Files.exists(messagesDirectory)) {
Files.createDirectory(messagesDirectory);
}
List<Locale> existing = new ArrayList<>();
try (Stream<Path> paths = Files.list(messagesDirectory)) {
paths.forEach(path -> {
String fileName = path.getFileName().toString();
String[] parts = fileName.split("\\.", 2);
if (parts.length != 2 || !parts[1].equals("yaml")) {
logger.warning("Unexpected messages file: " + fileName + " (invalid language code or not .yaml)");
return;
}
Locale locale = Locale.forLanguageTag(parts[0]);
if (locale == null) {
logger.warning("Unexpected messages file: " + fileName + " (unknown locale)");
return;
}
configs.put(locale, new MessagesConfigSingleManager<>(discordSRV, this, locale, true));
existing.add(locale);
});
}
if (config.messages.loadAllDefaults) {
// TODO: load all default default locales missing
}
} catch (Throwable t) {
throw new ConfigException("Failed to initialize messages configs", t);
}
} else {
Locale defaultLocale = discordSRV.defaultLocale();
configs.put(defaultLocale, new MessagesConfigSingleManager<>(discordSRV, this, defaultLocale, false));
}
for (Map.Entry<Locale, MessagesConfigSingleManager<C>> entry : configs.entrySet()) {
entry.getValue().load();
}
}
}
}

View File

@ -0,0 +1,44 @@
package com.discordsrv.common.config.configurate.manager;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.config.configurate.manager.abstraction.TranslatedConfigManager;
import com.discordsrv.common.config.configurate.manager.loader.YamlConfigLoaderProvider;
import com.discordsrv.common.config.messages.MessagesConfig;
import org.spongepowered.configurate.yaml.YamlConfigurationLoader;
import java.util.Locale;
public class MessagesConfigSingleManager<C extends MessagesConfig>
extends TranslatedConfigManager<C, YamlConfigurationLoader>
implements YamlConfigLoaderProvider {
private final MessagesConfigManager<C> aggregateManager;
private final Locale locale;
private final boolean multi;
protected MessagesConfigSingleManager(DiscordSRV discordSRV, MessagesConfigManager<C> aggregateManager, Locale locale, boolean multi) {
super(discordSRV);
this.aggregateManager = aggregateManager;
this.locale = locale;
this.multi = multi;
}
@Override
protected String fileName() {
if (multi) {
return aggregateManager.directory().resolve(locale.getISO3Language() + ".yaml").toString();
}
return MessagesConfig.FILE_NAME;
}
@Override
public Locale locale() {
return locale;
}
@Override
public C createConfiguration() {
return aggregateManager.createConfiguration();
}
}

View File

@ -71,7 +71,7 @@ public abstract class ConfigurateConfigManager<T, LT extends AbstractConfigurati
private final Path filePath;
private final ObjectMapper.Factory objectMapper;
private final ObjectMapper.Factory cleanObjectMapper;
private final LT loader;
private LT loader;
protected T configuration;
@ -83,7 +83,6 @@ public abstract class ConfigurateConfigManager<T, LT extends AbstractConfigurati
this.filePath = dataDirectory.resolve(fileName());
this.objectMapper = objectMapperBuilder().build();
this.cleanObjectMapper = cleanObjectMapperBuilder().build();
this.loader = createLoader(filePath, nodeOptions());
}
public Path filePath() {
@ -91,6 +90,9 @@ public abstract class ConfigurateConfigManager<T, LT extends AbstractConfigurati
}
public LT loader() {
if (loader == null) {
loader = createLoader(filePath(), nodeOptions());
}
return loader;
}
@ -312,6 +314,7 @@ public abstract class ConfigurateConfigManager<T, LT extends AbstractConfigurati
@Override
public void save() throws ConfigException {
try {
LT loader = loader();
CommentedConfigurationNode node = loader.createNode();
save(configuration, (Class<T>) configuration.getClass(), node);
loader.save(node);

View File

@ -36,6 +36,7 @@ import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
public abstract class TranslatedConfigManager<T extends Config, LT extends AbstractConfigurationLoader<CommentedConfigurationNode>>
extends ConfigurateConfigManager<T, LT> {
@ -53,6 +54,10 @@ public abstract class TranslatedConfigManager<T extends Config, LT extends Abstr
this.discordSRV = null;
}
public Locale locale() {
return discordSRV.defaultLocale();
}
@Override
public void load() throws ConfigException {
super.reload();
@ -112,9 +117,15 @@ public abstract class TranslatedConfigManager<T extends Config, LT extends Abstr
return null;
}
String languageCode = discordSRV.locale().getISO3Language();
URL resourceURL = discordSRV.getClass().getClassLoader()
.getResource("translations/" + languageCode + ".yml");
String languageCode = locale().getLanguage();
String countryCode = locale().getCountry();
ClassLoader classLoader = discordSRV.getClass().getClassLoader();
URL resourceURL = classLoader.getResource("translations/" + languageCode + "_" + countryCode + ".yaml");
if (resourceURL == null) {
resourceURL = classLoader.getResource("translations/" + languageCode + ".yaml");
}
if (resourceURL == null) {
return null;
}

View File

@ -87,6 +87,8 @@ public abstract class MainConfig implements Config {
@Comment("Configuration for the %discord_invite% placeholder. The below options will be attempted in the order they are in")
public DiscordInviteConfig invite = new DiscordInviteConfig();
public MessagesMainConfig messages = new MessagesMainConfig();
@Order(10) // To go below required linking config @ 5
@Comment("Configuration for the %player_avatar_url% placeholder")
public AvatarProviderConfig avatarProvider = new AvatarProviderConfig();

View File

@ -0,0 +1,18 @@
package com.discordsrv.common.config.main;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
import org.spongepowered.configurate.objectmapping.meta.Comment;
@ConfigSerializable
public class MessagesMainConfig {
@Comment("The language code for the default language, if left blank the system default will be used.\n"
+ "This should be in the ISO 639-1 format or ISO 639-1 (for example \"en\"), a underscore and a ISO 3166-1 country code to specify dialect (for example \"pt_BR\")")
public String defaultLanguage = "en";
@Comment("If there should be a messages file per language (based on the player's or user's language), otherwise using the default")
public boolean multiple = false;
@Comment("If all languages provided with DiscordSRV should be loaded into the messages directory, only functions when \"multiple\" is set to true")
public boolean loadAllDefaults = true;
}

View File

@ -0,0 +1,18 @@
package com.discordsrv.common.config.messages;
import com.discordsrv.common.config.Config;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
@ConfigSerializable
public class MessagesConfig implements Config {
public static final String FILE_NAME = "messages.yaml";
@Override
public final String getFileName() {
return FILE_NAME;
}
public String testOption = "test option";
}

View File

@ -20,6 +20,10 @@ package com.discordsrv.common.exception;
public class ConfigException extends Exception {
public ConfigException(String message) {
super(message);
}
public ConfigException(String message, Throwable cause) {
super(message, cause);
}

View File

@ -31,6 +31,7 @@ import com.discordsrv.api.discord.events.message.DiscordMessageDeleteEvent;
import com.discordsrv.api.discord.events.message.DiscordMessageReceiveEvent;
import com.discordsrv.api.discord.events.message.DiscordMessageUpdateEvent;
import com.discordsrv.api.event.bus.Subscribe;
import com.discordsrv.api.event.events.message.forward.discord.DiscordChatMessageForwardedEvent;
import com.discordsrv.api.event.events.message.receive.discord.DiscordChatMessageProcessEvent;
import com.discordsrv.api.event.events.message.receive.discord.DiscordChatMessageReceiveEvent;
import com.discordsrv.api.placeholder.util.Placeholders;
@ -203,6 +204,7 @@ public class DiscordChatMessageModule extends AbstractModule<DiscordSRV> {
}
gameChannel.sendMessage(component);
discordSRV.eventBus().publish(new DiscordChatMessageForwardedEvent(component, gameChannel));
}
public static class MessageSend {

View File

@ -24,6 +24,7 @@ import com.discordsrv.common.bootstrap.LifecycleManager;
import com.discordsrv.common.command.game.handler.ICommandHandler;
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
import com.discordsrv.common.config.configurate.manager.MessagesConfigManager;
import com.discordsrv.common.config.configurate.manager.abstraction.ServerConfigManager;
import com.discordsrv.common.config.connection.ConnectionConfig;
import com.discordsrv.common.config.main.MainConfig;
@ -31,6 +32,7 @@ import com.discordsrv.common.config.main.PluginIntegrationConfig;
import com.discordsrv.common.config.main.channels.base.ChannelConfig;
import com.discordsrv.common.config.main.generic.DestinationConfig;
import com.discordsrv.common.config.main.generic.ThreadConfig;
import com.discordsrv.common.config.messages.MessagesConfig;
import com.discordsrv.common.console.Console;
import com.discordsrv.common.debug.data.OnlineMode;
import com.discordsrv.common.debug.data.VersionInfo;
@ -54,7 +56,7 @@ import java.nio.file.Paths;
import java.util.List;
@SuppressWarnings("ConstantConditions")
public class MockDiscordSRV extends AbstractDiscordSRV<IBootstrap, MainConfig, ConnectionConfig> {
public class MockDiscordSRV extends AbstractDiscordSRV<IBootstrap, MainConfig, ConnectionConfig, MessagesConfig> {
public static final MockDiscordSRV INSTANCE = new MockDiscordSRV();
@ -225,4 +227,9 @@ public class MockDiscordSRV extends AbstractDiscordSRV<IBootstrap, MainConfig, C
return config;
}
@Override
public MessagesConfigManager<MessagesConfig> messagesConfigManager() {
return null;
}
}

View File

@ -21,10 +21,12 @@ package com.discordsrv.sponge;
import com.discordsrv.api.DiscordSRVApi;
import com.discordsrv.common.ServerDiscordSRV;
import com.discordsrv.common.command.game.handler.ICommandHandler;
import com.discordsrv.common.config.configurate.manager.MessagesConfigManager;
import com.discordsrv.common.config.connection.ConnectionConfig;
import com.discordsrv.common.config.main.MainConfig;
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
import com.discordsrv.common.config.messages.MessagesConfig;
import com.discordsrv.common.debug.data.OnlineMode;
import com.discordsrv.common.plugin.PluginManager;
import com.discordsrv.sponge.console.SpongeConsole;
@ -37,7 +39,7 @@ import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.lifecycle.ProvideServiceEvent;
import org.spongepowered.plugin.PluginContainer;
public class SpongeDiscordSRV extends ServerDiscordSRV<DiscordSRVSpongeBootstrap, MainConfig, ConnectionConfig> {
public class SpongeDiscordSRV extends ServerDiscordSRV<DiscordSRVSpongeBootstrap, MainConfig, ConnectionConfig, MessagesConfig> {
private final SpongeScheduler scheduler;
private final SpongeConsole console;
@ -105,6 +107,11 @@ public class SpongeDiscordSRV extends ServerDiscordSRV<DiscordSRVSpongeBootstrap
return null;
}
@Override
public MessagesConfigManager<MessagesConfig> messagesConfigManager() {
return null;
}
@Override
protected void enable() throws Throwable {
// Service provider

View File

@ -20,10 +20,12 @@ package com.discordsrv.velocity;
import com.discordsrv.common.ProxyDiscordSRV;
import com.discordsrv.common.command.game.handler.ICommandHandler;
import com.discordsrv.common.config.configurate.manager.MessagesConfigManager;
import com.discordsrv.common.config.connection.ConnectionConfig;
import com.discordsrv.common.config.main.MainConfig;
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
import com.discordsrv.common.config.messages.MessagesConfig;
import com.discordsrv.common.debug.data.OnlineMode;
import com.discordsrv.common.plugin.PluginManager;
import com.discordsrv.common.scheduler.StandardScheduler;
@ -39,7 +41,7 @@ import java.net.URL;
import java.net.URLClassLoader;
import java.util.jar.JarFile;
public class VelocityDiscordSRV extends ProxyDiscordSRV<DiscordSRVVelocityBootstrap, MainConfig, ConnectionConfig> {
public class VelocityDiscordSRV extends ProxyDiscordSRV<DiscordSRVVelocityBootstrap, MainConfig, ConnectionConfig, MessagesConfig> {
private final StandardScheduler scheduler;
private final VelocityConsole console;
@ -121,6 +123,11 @@ public class VelocityDiscordSRV extends ProxyDiscordSRV<DiscordSRVVelocityBootst
return null;
}
@Override
public MessagesConfigManager<MessagesConfig> messagesConfigManager() {
return null;
}
@Override
protected void enable() throws Throwable {
super.enable();