From 4bd649d52dbb22870b68f15e25f7101bfbfe4614 Mon Sep 17 00:00:00 2001 From: JvstvsHD <79066214+JvstvsHD@users.noreply.github.com> Date: Sun, 1 Sep 2024 16:47:24 +0200 Subject: [PATCH] Remove ability to en/disable whitelist directly via command. Instead, the whitelist's state must be changed in the config file, thereafter you can reload the config through /necrify reload --- build.gradle.kts | 6 +- buildSrc/src/main/kotlin/Git.kt | 1 + buildSrc/src/main/kotlin/Version.kt | 14 +++- .../necrify/common/AbstractNecrifyPlugin.java | 48 +++++++++--- .../common/commands/NecrifyCommand.java | 76 +++++++++++-------- .../main/resources/translations/de.properties | 4 + .../main/resources/translations/en.properties | 4 + .../velocity/NecrifyVelocityPlugin.java | 62 ++++----------- 8 files changed, 119 insertions(+), 96 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 97385d27..cd47874e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -107,13 +107,13 @@ subprojects { hangarPublish { publications.register("necrify") { version.set(buildVersion()) - channel.set(if (!isRelease) "Snapshot" else "Release") + channel.set(if (!rootProject.isRelease) "Snapshot" else "Release") id.set("necrify") apiKey.set(System.getenv("HANGAR_API_TOKEN") ?: "") - if (!isRelease) { + if (!rootProject.isRelease) { changelog.set(changelogMessage()) } else { - changelog.set("Changes will be provided shortly.\nComplete changelog can be found on GitHub: https://www.github.com/JvstvsHD/necrify/releases/tag/v$version") + changelog.set("Changes will be provided shortly.\nComplete changelog can be found on GitHub: https://www.github.com/JvstvsHD/necrify/releases/tag/v${rootProject.version.toString()}") } platforms { register(Platforms.PAPER) { diff --git a/buildSrc/src/main/kotlin/Git.kt b/buildSrc/src/main/kotlin/Git.kt index e1e74158..de636e2c 100644 --- a/buildSrc/src/main/kotlin/Git.kt +++ b/buildSrc/src/main/kotlin/Git.kt @@ -26,6 +26,7 @@ fun Project.git(vararg command: String): String { project.exec { commandLine = listOf("git", *command) standardOutput = byteOut + errorOutput = System.err } return byteOut.toString(Charsets.UTF_8.name()).trim() } diff --git a/buildSrc/src/main/kotlin/Version.kt b/buildSrc/src/main/kotlin/Version.kt index 8a5646eb..2b4f317e 100644 --- a/buildSrc/src/main/kotlin/Version.kt +++ b/buildSrc/src/main/kotlin/Version.kt @@ -15,10 +15,16 @@ fun Project.publishingVersion(): String { } fun Project.buildVersion(): String { - val git = Git(project) val versionString: String = project.version as String - return if (project.isSnapshot) "$versionString-${git.latestCommitHashShort()}" - else versionString + if (!project.isSnapshot) { + return versionString + } + val buildNum = project.buildNumber() + if (buildNum != null) { + return "$versionString-$buildNum" + } else { + return versionString + } } fun Project.changelogMessage() = with(git) { @@ -26,7 +32,7 @@ fun Project.changelogMessage() = with(git) { } val Project.isRelease: Boolean - get() = version.toString().contains("-") + get() = !version.toString().contains("-") val Project.isSnapshot: Boolean get() = version.toString().endsWith("-SNAPSHOT") \ No newline at end of file diff --git a/necrify-common/src/main/java/de/jvstvshd/necrify/common/AbstractNecrifyPlugin.java b/necrify-common/src/main/java/de/jvstvshd/necrify/common/AbstractNecrifyPlugin.java index ccc4457c..07eab98a 100644 --- a/necrify-common/src/main/java/de/jvstvshd/necrify/common/AbstractNecrifyPlugin.java +++ b/necrify-common/src/main/java/de/jvstvshd/necrify/common/AbstractNecrifyPlugin.java @@ -26,6 +26,7 @@ import de.jvstvshd.necrify.api.punishment.StandardPunishmentType; import de.jvstvshd.necrify.api.user.NecrifyUser; import de.jvstvshd.necrify.common.commands.*; +import de.jvstvshd.necrify.common.config.ConfigurationManager; import de.jvstvshd.necrify.common.punishment.NecrifyKick; import de.jvstvshd.necrify.common.punishment.NecrifyPunishmentFactory; import net.kyori.adventure.text.Component; @@ -44,7 +45,10 @@ import org.slf4j.Logger; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Set; +import java.util.UUID; import java.util.concurrent.ExecutorService; public abstract class AbstractNecrifyPlugin implements Necrify { @@ -54,9 +58,13 @@ public abstract class AbstractNecrifyPlugin implements Necrify { public static final String BUILD_NUMBER = BuildParameters.BUILD_NUMBER; protected ExecutorService executorService; + protected final ConfigurationManager configurationManager; + private final Logger logger; - public AbstractNecrifyPlugin(ExecutorService executorService) { + public AbstractNecrifyPlugin(ExecutorService executorService, ConfigurationManager configurationManager, Logger logger) { this.executorService = executorService; + this.configurationManager = configurationManager; + this.logger = logger; } @Override @@ -73,10 +81,10 @@ public AbstractNecrifyPlugin(ExecutorService executorService) { * Registers the punishment types of the plugin to the {@link PunishmentTypeRegistry}. This method should be called * before any user-input is processed, as the registry is used to determine the type of punishment that should be created. */ - public final void registerRegistries() { - var registry = new NecrifyPunishmentFactory(this); + public final void registerFactories() { + var factory = new NecrifyPunishmentFactory(this); for (StandardPunishmentType type : StandardPunishmentType.values()) { - PunishmentTypeRegistry.registerType(type, registry); + PunishmentTypeRegistry.registerType(type, factory); } } @@ -137,7 +145,23 @@ public final void registerCommands(CommandManager manager, boolean } //TODO: Move config to necrify-common - public abstract String getDefaultReason(PunishmentType type); + public String getDefaultReason(PunishmentType type) { + return configurationManager.getConfiguration().getPunishmentConfigData().getPunishmentMessages().get(type.getId()); + } + + public boolean loadConfig() { + try { + configurationManager.load(); + if (configurationManager.getConfiguration().isWhitelistActivated()) { + logger.info("Whitelist is activated. This means that nobody can join this server beside players you have explicitly allowed to join this server via /necrify user whitelist (toggles current state)."); + } + } catch (IOException e) { + logger.error("Could not load configuration", e); + logger.error("Aborting start-up"); + return false; + } + return true; + } @SuppressWarnings("ConstantValue") public static String buildInfo() { @@ -149,14 +173,18 @@ public static String buildInfo() { return buildInfo + ")"; } + public ConfigurationManager getConfig() { + return configurationManager; + } + public abstract NecrifyKick createKick(Component reason, NecrifyUser user, UUID punishmentUuid); - public abstract Logger getLogger(); + public Logger getLogger() { + return logger; + } + //TODO return just a set of objects. Create a new User object that does not get loaded from the database. public abstract Set> getOnlinePlayers(); public abstract boolean isWhitelistActive(); - - //TODO kick all non-whitelisted players - public abstract void setWhitelistActive(boolean active) throws IOException; } diff --git a/necrify-common/src/main/java/de/jvstvshd/necrify/common/commands/NecrifyCommand.java b/necrify-common/src/main/java/de/jvstvshd/necrify/common/commands/NecrifyCommand.java index 16f247dd..c84af7be 100644 --- a/necrify-common/src/main/java/de/jvstvshd/necrify/common/commands/NecrifyCommand.java +++ b/necrify-common/src/main/java/de/jvstvshd/necrify/common/commands/NecrifyCommand.java @@ -26,6 +26,7 @@ import de.jvstvshd.necrify.api.user.NecrifyUser; import de.jvstvshd.necrify.api.user.UserDeletionReason; import de.jvstvshd.necrify.common.AbstractNecrifyPlugin; +import de.jvstvshd.necrify.common.config.ConfigData; import de.jvstvshd.necrify.common.util.PunishmentHelper; import de.jvstvshd.necrify.common.util.Util; import net.kyori.adventure.text.Component; @@ -54,7 +55,6 @@ import java.util.List; import java.util.Locale; import java.util.Objects; -import java.util.concurrent.CompletableFuture; public class NecrifyCommand { @@ -65,7 +65,6 @@ public class NecrifyCommand { private static final List PUNISHMENT_COMMAND_OPTIONS = List.of("cancel", "remove", "info", "change"); private static final List USER_COMMAND_OPTIONS = List.of("info", "delete", "whitelist"); - private static final List WHITELIST_COMMAND_OPTIONS = List.of("enable", "disable", "status"); public NecrifyCommand(AbstractNecrifyPlugin plugin) { this.plugin = plugin; @@ -315,30 +314,52 @@ public void userCommand( } } - @Command("necrify whitelist [option]") + @Command("necrify reload") + @Permission(value = {"necrify.command.reload", "necrify.admin"}, mode = Permission.Mode.ANY_OF) + public void reloadCommand(NecrifyUser sender) { + try { + sender.sendMessage(provider.provide("command.reload.start").color(NamedTextColor.GRAY)); + long start = System.currentTimeMillis(); + final ConfigData old = plugin.getConfig().getConfiguration(); + plugin.getConfig().load(); + ConfigData reloaded = plugin.getConfig().getConfiguration(); + if (!old.isWhitelistActivated() && reloaded.isWhitelistActivated()) { + Util.executeAsync(() -> { + logger.info("Whitelist activated. Kicking all players who aren't allowed here anymore. This may take some time..."); + var startKick = System.currentTimeMillis(); + var onlinePlayers = plugin.getOnlinePlayers(); + onlinePlayers.forEach(pair -> { + try { + var user = plugin.getUserManager().loadOrCreateUser(pair.second()).join().get(); + if (!user.isWhitelisted()) { + user.kick(provider.provide("whitelist.removed").color(NamedTextColor.RED)).join(); + } + } catch (Exception e) { + logException(e); + } + }); + logger.info("Kicked all non-whitelisted players. Took {} seconds.", (System.currentTimeMillis() - startKick) / 1000.0); + return null; + }, plugin.getExecutor()); + } + String took = String.format("%.2f", (System.currentTimeMillis() - start) / 1000.0); + sender.sendMessage(provider.provide("command.reload.success", Component.text(took).color(NamedTextColor.YELLOW)).color(NamedTextColor.GREEN)); + } catch (IOException e) { + logException(sender, e); + sender.sendMessage(provider.provide("command.reload.failure").color(NamedTextColor.RED)); + } + } + + @Command("necrify whitelist") @Permission(value = {"necrify.command.whitelist", "necrify.admin"}, mode = Permission.Mode.ANY_OF) public void whitelistCommand( NecrifyUser sender, - @Argument(value = "option", description = "Option to manage the whitelist", suggestions = "suggestWhitelistCommandOptions") @Default("status") String option + @Argument(value = "option", description = "Option to retrieve the whitelist's status", suggestions = "suggestWhitelistCommandOptions") @Default("status") String option ) { - switch (option) { - case "status" -> { - var whitelist = plugin.isWhitelistActive(); - var activeState = whitelist ? "active" : "inactive"; - sender.sendMessage(provider.provide("command.whitelist." + activeState).color(NamedTextColor.GRAY)); - } - case "enable", "disable" -> { - var state = "enable".equals(option); - try { - plugin.setWhitelistActive(state); - } catch (IOException e) { - logException(sender, e); - return; - } - sender.sendMessage(provider.provide("command.whitelist." + (state ? "enabled" : "disabled")).color(NamedTextColor.GREEN)); - } - default -> sender.sendMessage(unknownOption(option, WHITELIST_COMMAND_OPTIONS)); - } + var whitelist = plugin.isWhitelistActive(); + var activeState = whitelist ? "active" : "inactive"; + sender.sendMessage(provider.provide("command.whitelist." + activeState).color(NamedTextColor.GRAY)); + sender.sendMessage(provider.provide("whitelist.change-in-config")); } //SUGGESTIONS @@ -383,15 +404,6 @@ public List suggestUserCommandOptions(CommandContext suggestWhitelistCommandOptions(CommandContext context, CommandInput input) { - return WHITELIST_COMMAND_OPTIONS - .stream() - .filter(option -> option.toLowerCase().startsWith(input.peekString().toLowerCase())) - .map(option -> ComponentTooltipSuggestion.suggestion(option, miniMessage(option))) - .toList(); - } - //HELPER METHODS /** @@ -448,7 +460,7 @@ private void tryChainPunishments(NecrifyUser sender, NecrifyUser target, Punishm sender.sendMessage(provider.provide("command.punishment.chain.info").color(NamedTextColor.GRAY)); for (Punishment unchainedPunishment : unchainedPunishments) { sender.sendMessage(provider.provide("command.punishment.chain", - Component.text(unchainedPunishment.getPunishmentUuid().toString()).color(NamedTextColor.YELLOW)).color(NamedTextColor.GRAY) + Component.text(unchainedPunishment.getPunishmentUuid().toString()).color(NamedTextColor.YELLOW)).color(NamedTextColor.GRAY) .clickEvent(ClickEvent.runCommand("/necrify punishment " + unchainedPunishment.getPunishmentUuid().toString().toLowerCase(Locale.ROOT) + " chain " + newPunishment.getPunishmentUuid().toString().toLowerCase(Locale.ROOT))) .hoverEvent((HoverEventSource) op -> HoverEvent.showText(provider.provide("command.punishment.chain").color(NamedTextColor.GREEN)))); diff --git a/necrify-common/src/main/resources/translations/de.properties b/necrify-common/src/main/resources/translations/de.properties index 06db186b..b950c227 100644 --- a/necrify-common/src/main/resources/translations/de.properties +++ b/necrify-common/src/main/resources/translations/de.properties @@ -27,6 +27,9 @@ command.punishment.punishments=Dieser Spieler hat derzeit {0} laufende Bestrafun command.punishment.uuid-parse-error={0} ist keine valide UUID. command.punishment.unknown-option=Unbekannte Option: {0} command.punishment.unknown-punishment-id=Es konnte keine Strafe für die ID {0} gefunden werden. +command.reload.start=Die Konfiguration wird neu geladen. Hierdurch wird nicht die Datenbank-Verbindung neugestartet. Bitte starte den Server dazu neu! +command.reload.success=Die Konfiguration wurde erfolgreich in {0}s neu geladen. +command.reload.failure=Beim Neuladen der Konfiguration ist ein Fehler aufgetreten. Bitte überprüfe die Konsole. command.tempban.usage=Bitte benutze /tempban [Grund]. command.tempban.success=Du hast den Spieler {0}/{1} für {2} bis {3} gebannt. command.tempmute.usage=Bitte benutze /tempmute [Grund]. @@ -66,5 +69,6 @@ punishment.mute.temp.full-reason=Du wurdest f prefix=[Bestrafung] whitelist.blacklisted=Die Whitelist ist derzeit aktiv. Um zu joinen, kontaktiere bitte das Server-Team, da du nicht auf der Whitelist stehst. whitelist.removed=Du wurdest soeben von der Whitelist entfernt. Bitte kontaktiere das Server-Team, um wieder hinzugefügt zu werden. +whitelist.change-in-config=Um die Whitelist zu aktivieren oder deaktivieren, ändere bitte die Konfiguration unter whitelist-activated. Nutze anschließend /necrify reload, um die Änderungen zu übernehmen. whitelist.status.whitelisted=Zugriff erlaubt whitelist.status.disallowed=Zugriff verweigert \ No newline at end of file diff --git a/necrify-common/src/main/resources/translations/en.properties b/necrify-common/src/main/resources/translations/en.properties index dd92262e..a7d4a8d6 100644 --- a/necrify-common/src/main/resources/translations/en.properties +++ b/necrify-common/src/main/resources/translations/en.properties @@ -25,6 +25,9 @@ command.punishment.punishments=This player has {0} punishment(s). command.punishment.uuid-parse-error=Could not parse string {0} as uuid. command.punishment.unknown-option=Unknown option: {0} command.punishment.unknown-punishment-id=Could not find a punishment for id {0}. +command.reload.start=The configuration is being reloaded. This does not restart the database connection. Please restart the server for that. +command.reload.success=The configuration has been successfully reloaded in {0}s. +command.reload.failure=An error occurred while reloading the configuration. Please check the console. command.tempban.usage=Please use /tempban [reason]. command.tempban.success=You have banned the player {0}/{1} for {2} until {3}. command.tempmute.usage=Please use /tempmute [reason]. @@ -64,5 +67,6 @@ punishment.mute.temp.full-reason=You are muted for {0}. Reason: {1}. End of puni prefix=[Punishment] whitelist.blacklisted=The whitelist is currently active. To join, please contact the server team since you are currently not whitelisted. whitelist.removed=You were removed from the whitelist. +whitelist.change-in-config=In order to change the whitelist status, change whitelist-activated in the config. Afterwards, use /necrify reload to apply the changes. whitelist.status.whitelisted=access allowed whitelist.status.disallowed=access disallowed \ No newline at end of file diff --git a/necrify-velocity/src/main/java/de/jvstvshd/necrify/velocity/NecrifyVelocityPlugin.java b/necrify-velocity/src/main/java/de/jvstvshd/necrify/velocity/NecrifyVelocityPlugin.java index 187bcd50..3e98713a 100644 --- a/necrify-velocity/src/main/java/de/jvstvshd/necrify/velocity/NecrifyVelocityPlugin.java +++ b/necrify-velocity/src/main/java/de/jvstvshd/necrify/velocity/NecrifyVelocityPlugin.java @@ -57,7 +57,6 @@ import de.jvstvshd.necrify.api.message.MessageProvider; import de.jvstvshd.necrify.api.punishment.Punishment; import de.jvstvshd.necrify.api.punishment.PunishmentManager; -import de.jvstvshd.necrify.api.punishment.PunishmentType; import de.jvstvshd.necrify.api.punishment.util.PlayerResolver; import de.jvstvshd.necrify.api.user.NecrifyUser; import de.jvstvshd.necrify.api.user.UserManager; @@ -114,8 +113,6 @@ public class NecrifyVelocityPlugin extends AbstractNecrifyPlugin { private final ProxyServer server; - private final Logger logger; - private final ConfigurationManager configurationManager; private static final String MUTES_DISABLED_STRING = """ Since 1.19.1, cancelling chat messages on proxy is not possible anymore. Therefore, we have to listen to the chat event on the actual game server. This means that there has to be a spigot/paper extension to this plugin which is not yet available unless there's a possibility. Therefore all mute related features won't work at the moment. @@ -145,11 +142,9 @@ public class NecrifyVelocityPlugin extends AbstractNecrifyPlugin { public NecrifyVelocityPlugin(ProxyServer server, Logger logger, @DataDirectory Path dataDirectory) { super(Executors.newCachedThreadPool(new ThreadFactoryBuilder() .setUncaughtExceptionHandler((t, e) -> logger.error("An error occurred in thread {}", t.getName(), e)) - .build())); + .build()), new ConfigurationManager(dataDirectory.resolve("config.yml")), logger); this.server = server; - this.logger = logger; this.dataDirectory = dataDirectory; - this.configurationManager = new ConfigurationManager(dataDirectory.resolve("config.yml")); this.communicator = new MessagingChannelCommunicator(server, this); this.playerResolver = new DefaultPlayerResolver(server); this.eventDispatcher = new EventDispatcher(getExecutor(), new Slf4jLogger(logger)); @@ -158,7 +153,7 @@ public NecrifyVelocityPlugin(ProxyServer server, Logger logger, @DataDirectory P //TODO keep changed implementations and do not override them. @Subscribe public void onProxyInitialization(ProxyInitializeEvent event) { - Thread.setDefaultUncaughtExceptionHandler((t, e) -> logger.error("An error occurred in thread {}", t.getName(), e)); + Thread.setDefaultUncaughtExceptionHandler((t, e) -> getLogger().error("An error occurred in thread {}", t.getName(), e)); long start = System.currentTimeMillis(); try { DependencyManager manager = new DependencyManager(dataDirectory.resolve("cache")); @@ -166,10 +161,10 @@ public void onProxyInitialization(ProxyInitializeEvent event) { Executor executor = Executors.newCachedThreadPool(); if (!manager.getAllPaths(true).stream().allMatch(Files::exists)) { manager.downloadAll(executor, Collections.singletonList(new StandardRepository("https://repo1.maven.org/maven2"))).join(); - logger.info("Relocating all dependencies..."); + getLogger().info("Relocating all dependencies..."); long relocateStart = System.currentTimeMillis(); manager.relocateAll(executor).join(); - logger.info("Successfully relocated all dependencies in {}ms", System.currentTimeMillis() - relocateStart); + getLogger().info("Successfully relocated all dependencies in {}ms", System.currentTimeMillis() - relocateStart); } else { var depField = manager.getClass().getDeclaredField("step"); depField.setAccessible(true); @@ -178,43 +173,36 @@ public void onProxyInitialization(ProxyInitializeEvent event) { } manager.loadAll(executor, new VelocityClasspathAppender(this, server)).join(); } catch (Exception e) { - logger.error("Could not load required dependencies. Aborting start-up", e); + getLogger().error("Could not load required dependencies. Aborting start-up", e); return; } - logger.info("Successfully loaded all dependencies in {}ms", System.currentTimeMillis() - start); - try { - configurationManager.load(); - if (configurationManager.getConfiguration().isWhitelistActivated()) { - logger.info("Whitelist is activated. This means that nobody can join this server beside players you have explicitly allowed to join this server via /necrify user whitelist (toggles current state)."); - } - this.messageProvider = new ResourceBundleMessageProvider(configurationManager.getConfiguration().getDefaultLanguage()); - } catch (IOException e) { - logger.error("Could not load configuration", e); - logger.error("Aborting start-up"); + getLogger().info("Successfully loaded all dependencies in {}ms", System.currentTimeMillis() - start); + if (!loadConfig()) { return; } + this.messageProvider = new ResourceBundleMessageProvider(configurationManager.getConfiguration().getDefaultLanguage()); dataSource = createDataSource(); QueryConfiguration.setDefault(QueryConfiguration.builder(dataSource).setThrowExceptions(true).build()); punishmentManager = new DefaultPunishmentManager(server, dataSource, this); - registerRegistries(); + registerFactories(); this.userManager = new VelocityUserManager(getExecutor(), server, Caffeine.newBuilder().maximumSize(100).expireAfterWrite(Duration.ofMinutes(10)).build(), Caffeine.newBuilder().maximumSize(100).expireAfterWrite(Duration.ofMinutes(10)).build(), this); try { updateDatabase(); } catch (SQLException | IOException e) { - logger.error("Could not create table necrify_punishment in database {}", dataSource.getDataSourceProperties().get("dataSource.databaseName"), e); + getLogger().error("Could not create table necrify_punishment in database {}", dataSource.getDataSourceProperties().get("dataSource.databaseName"), e); } setup(server.getEventManager()); - logger.warn("Persecution of mutes cannot be granted on all servers unless the required paper plugin is installed."); + getLogger().warn("Persecution of mutes cannot be granted on all servers unless the required paper plugin is installed."); eventDispatcher.register(communicator); eventDispatcher.register(userManager); - logger.info("Velocity Punishment Plugin {} has been loaded. This is only a dev build and thus may be unstable.", buildInfo()); + getLogger().info("Velocity Punishment Plugin {} has been loaded. This is only a dev build and thus may be unstable.", buildInfo()); } private void setup(EventManager eventManager) { eventManager.register(this, communicator); eventManager.register(this, new ConnectListener(this, Executors.newCachedThreadPool(), server)); eventManager.register(this, userManager); - logger.info(MUTES_DISABLED_STRING); + getLogger().info(MUTES_DISABLED_STRING); final Injector childInjector = injector.createChildInjector( new CloudInjectionModule<>( @@ -293,7 +281,7 @@ private void updateDatabase() throws IOException, SQLException { .single(Call.of().bind(MiniMessage.miniMessage().serialize(reason)).bind(punishmentId.toString())) .update(); }).all(); - logger.info("Updated {} reasons to minimessage format.", updatedReasons.size()); + getLogger().info("Updated {} reasons to minimessage format.", updatedReasons.size()); }; switch (configurationManager.getConfiguration().getDataBaseData().sqlType().name().toLowerCase(Locale.ROOT)) { case "postgresql", "postgres" -> @@ -307,7 +295,7 @@ private void updateDatabase() throws IOException, SQLException { .preUpdateHook(new SqlVersion(1, 1), preUpdateHook) .execute(); default -> - logger.warn("Database type is not (yet) supported for automatic updates. Please update the database manually."); + getLogger().warn("Database type is not (yet) supported for automatic updates. Please update the database manually."); } } @@ -354,26 +342,11 @@ public void setMessageProvider(@NotNull MessageProvider messageProvider) { this.messageProvider = messageProvider; } - @Override - public Logger getLogger() { - return logger; - } - @Override public boolean isWhitelistActive() { return configurationManager.getConfiguration().isWhitelistActivated(); } - @Override - public void setWhitelistActive(boolean active) throws IOException { - configurationManager.getConfiguration().setWhitelistActivated(active); - configurationManager.save(); - } - - public ConfigurationManager getConfig() { - return configurationManager; - } - @Override public @NotNull UserManager getUserManager() { return userManager; @@ -475,9 +448,4 @@ public NecrifyKick createKick(Component reason, NecrifyUser user, UUID punishmen public Set> getOnlinePlayers() { return server.getAllPlayers().stream().map(player -> Pair.of(player.getUsername(), player.getUniqueId())).collect(Collectors.toSet()); } - - @Override - public String getDefaultReason(PunishmentType type) { - return configurationManager.getConfiguration().getPunishmentConfigData().getPunishmentMessages().get(type.getId()); - } }