mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2024-10-31 08:32:18 +01:00
Initial commit for messages config
This commit is contained in:
parent
3c71ade347
commit
e2143f0cc1
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -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
|
||||
|
@ -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;
|
||||
@ -83,6 +86,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;
|
||||
@ -109,7 +113,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);
|
||||
@ -379,6 +388,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
|
||||
@ -429,8 +453,19 @@ 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.isBlank(defaultLanguage)) {
|
||||
for (Locale locale : Locale.getAvailableLocales()) {
|
||||
if (locale.getISO3Language().equals(defaultLanguage)) {
|
||||
return locale;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Locale.getDefault();
|
||||
}
|
||||
|
||||
@ -602,6 +637,7 @@ public abstract class AbstractDiscordSRV<B extends IBootstrap, C extends MainCon
|
||||
try {
|
||||
connectionConfigManager().load();
|
||||
configManager().load();
|
||||
messagesConfigManager().load();
|
||||
|
||||
channelConfig().reload();
|
||||
} catch (Throwable t) {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -0,0 +1,30 @@
|
||||
package com.discordsrv.common.config.configurate.manager;
|
||||
|
||||
import com.discordsrv.common.DiscordSRV;
|
||||
import com.discordsrv.common.config.messages.MessagesConfig;
|
||||
import com.discordsrv.common.exception.ConfigException;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class MessagesConfigManager<C extends MessagesConfig> {
|
||||
|
||||
public Map<String, MessagesConfigSingleManager<C>> configs = new LinkedHashMap<>();
|
||||
|
||||
public MessagesConfigManager(DiscordSRV discordSRV) {
|
||||
configs.put(Locale.US.getISO3Language(), new MessagesConfigSingleManager<>(discordSRV, this, Locale.US));
|
||||
}
|
||||
|
||||
public abstract C createConfiguration();
|
||||
|
||||
public MessagesConfigSingleManager<C> getManager(Locale locale) {
|
||||
return configs.get(locale.getISO3Language());
|
||||
}
|
||||
|
||||
public void load() throws ConfigException {
|
||||
for (Map.Entry<String, MessagesConfigSingleManager<C>> entry : configs.entrySet()) {
|
||||
entry.getValue().load();
|
||||
}
|
||||
}
|
||||
}
|
@ -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.nio.file.Paths;
|
||||
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;
|
||||
|
||||
protected MessagesConfigSingleManager(DiscordSRV discordSRV, MessagesConfigManager<C> aggregateManager, Locale locale) {
|
||||
super(discordSRV);
|
||||
this.aggregateManager = aggregateManager;
|
||||
this.locale = locale;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String fileName() {
|
||||
boolean multiple = discordSRV.config().messages.multiple;
|
||||
if (multiple) {
|
||||
return Paths.get("messages", locale.getISO3Language() + ".yaml").toString();
|
||||
}
|
||||
|
||||
return MessagesConfig.FILE_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Locale locale() {
|
||||
return locale;
|
||||
}
|
||||
|
||||
@Override
|
||||
public C createConfiguration() {
|
||||
return aggregateManager.createConfiguration();
|
||||
}
|
||||
}
|
@ -69,26 +69,30 @@ public abstract class ConfigurateConfigManager<T, LT extends AbstractConfigurati
|
||||
};
|
||||
|
||||
protected final DiscordSRV discordSRV;
|
||||
private final Path filePath;
|
||||
private final ObjectMapper.Factory objectMapper;
|
||||
private final ObjectMapper.Factory cleanObjectMapper;
|
||||
private final LT loader;
|
||||
private Path filePath;
|
||||
private LT loader;
|
||||
|
||||
protected T configuration;
|
||||
|
||||
public ConfigurateConfigManager(DiscordSRV discordSRV) {
|
||||
this.discordSRV = discordSRV;
|
||||
this.filePath = discordSRV.dataDirectory().resolve(fileName());
|
||||
this.objectMapper = objectMapperBuilder().build();
|
||||
this.cleanObjectMapper = cleanObjectMapperBuilder().build();
|
||||
this.loader = createLoader(filePath, nodeOptions());
|
||||
}
|
||||
|
||||
public Path filePath() {
|
||||
if (filePath == null) {
|
||||
filePath = discordSRV.dataDirectory().resolve(fileName());
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public LT loader() {
|
||||
if (loader == null) {
|
||||
loader = createLoader(filePath(), nodeOptions());
|
||||
}
|
||||
return loader;
|
||||
}
|
||||
|
||||
@ -310,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);
|
||||
|
@ -35,6 +35,7 @@ import java.net.URL;
|
||||
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> {
|
||||
@ -45,6 +46,10 @@ public abstract class TranslatedConfigManager<T extends Config, LT extends Abstr
|
||||
super(discordSRV);
|
||||
}
|
||||
|
||||
public Locale locale() {
|
||||
return discordSRV.defaultLocale();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() throws ConfigException {
|
||||
super.reload();
|
||||
@ -100,9 +105,12 @@ public abstract class TranslatedConfigManager<T extends Config, LT extends Abstr
|
||||
}
|
||||
|
||||
private ConfigurationNode getTranslationRoot() throws ConfigurateException {
|
||||
String languageCode = discordSRV.locale().getISO3Language();
|
||||
URL resourceURL = discordSRV.getClass().getClassLoader()
|
||||
.getResource("translations/" + languageCode + ".yml");
|
||||
String languageCode = locale().getISO3Language();
|
||||
ClassLoader classLoader = discordSRV.getClass().getClassLoader();
|
||||
URL resourceURL = classLoader.getResource("translations/" + languageCode + ".yaml");
|
||||
if (resourceURL == null) {
|
||||
resourceURL = classLoader.getResource("translations/eng.yaml");
|
||||
}
|
||||
if (resourceURL == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -0,0 +1,14 @@
|
||||
package com.discordsrv.common.config.main;
|
||||
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
import org.spongepowered.configurate.objectmapping.meta.Comment;
|
||||
|
||||
@ConfigSerializable
|
||||
public class MessagesMainConfig {
|
||||
|
||||
@Comment("If there should be multiple messages files, one for every language")
|
||||
public boolean multiple = false;
|
||||
|
||||
@Comment("The 3 letter ISO 639-2 code for the default language, if left blank the system default will be used")
|
||||
public String defaultLanguage = "eng";
|
||||
}
|
@ -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";
|
||||
|
||||
}
|
@ -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 {
|
||||
|
@ -21,12 +21,14 @@ package com.discordsrv.common;
|
||||
import com.discordsrv.common.bootstrap.IBootstrap;
|
||||
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;
|
||||
import com.discordsrv.common.config.main.PluginIntegrationConfig;
|
||||
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
|
||||
import com.discordsrv.common.config.configurate.manager.abstraction.ServerConfigManager;
|
||||
import com.discordsrv.common.config.messages.MessagesConfig;
|
||||
import com.discordsrv.common.console.Console;
|
||||
import com.discordsrv.common.debug.data.OnlineMode;
|
||||
import com.discordsrv.common.logging.Logger;
|
||||
@ -44,7 +46,7 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
@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();
|
||||
|
||||
@ -148,6 +150,11 @@ public class MockDiscordSRV extends AbstractDiscordSRV<IBootstrap, MainConfig, C
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessagesConfigManager<MessagesConfig> messagesConfigManager() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void waitForStatus(Status status) throws InterruptedException {
|
||||
super.waitForStatus(status);
|
||||
|
@ -22,10 +22,12 @@ import com.discordsrv.common.AbstractDiscordSRV;
|
||||
import com.discordsrv.common.bootstrap.IBootstrap;
|
||||
import com.discordsrv.common.bootstrap.LifecycleManager;
|
||||
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.console.Console;
|
||||
import com.discordsrv.common.debug.data.OnlineMode;
|
||||
import com.discordsrv.common.logging.Logger;
|
||||
@ -40,7 +42,7 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public class MockDiscordSRV extends AbstractDiscordSRV<IBootstrap, MainConfig, ConnectionConfig> {
|
||||
public class MockDiscordSRV extends AbstractDiscordSRV<IBootstrap, MainConfig, ConnectionConfig, MessagesConfig> {
|
||||
|
||||
public MockDiscordSRV() {
|
||||
super(new IBootstrap() {
|
||||
@ -115,4 +117,9 @@ public class MockDiscordSRV extends AbstractDiscordSRV<IBootstrap, MainConfig, C
|
||||
public MainConfigManager<MainConfig> configManager() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessagesConfigManager<MessagesConfig> messagesConfigManager() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user