From 4c18c9c2887f493ba210040d5d32e0105e9b3018 Mon Sep 17 00:00:00 2001 From: carbotaniuman <41451839+carbotaniuman@users.noreply.github.com> Date: Wed, 5 Aug 2020 10:07:16 -0500 Subject: [PATCH] Fix some code --- src/main/kotlin/mdnet/base/MangaDexClient.kt | 8 +++++--- src/main/kotlin/mdnet/base/ServerHandler.kt | 6 +----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/mdnet/base/MangaDexClient.kt b/src/main/kotlin/mdnet/base/MangaDexClient.kt index 03e85a3..87dbf46 100644 --- a/src/main/kotlin/mdnet/base/MangaDexClient.kt +++ b/src/main/kotlin/mdnet/base/MangaDexClient.kt @@ -308,8 +308,7 @@ class MangaDexClient(private val clientSettingsFile: String) { /** * Starts the WebUI if the ClientSettings demand it. - * Because this method checks if the WebUI is needed, - * it can be safely called before checking yourself + * This method checks if the WebUI is needed, */ private fun startWebUi() { val state = this.state @@ -332,6 +331,9 @@ class MangaDexClient(private val clientSettingsFile: String) { } } + /** + * Shutdowns the MangaDexClient + */ fun shutdown() { LOGGER.info { "Mangadex@Home Client stopping" } @@ -426,7 +428,7 @@ class MangaDexClient(private val clientSettingsFile: String) { // If we aren't restarting the server // We can update the settings now this.state = state.copy(clientSettings = newSettings) - serverHandler.setClientSettings(newSettings) + serverHandler.settings = newSettings LOGGER.info { "Reloaded ClientSettings: $newSettings" } // Start the WebUI if we had to stop it diff --git a/src/main/kotlin/mdnet/base/ServerHandler.kt b/src/main/kotlin/mdnet/base/ServerHandler.kt index 13ac094..4c74105 100644 --- a/src/main/kotlin/mdnet/base/ServerHandler.kt +++ b/src/main/kotlin/mdnet/base/ServerHandler.kt @@ -43,7 +43,7 @@ object ServerHandlerJackson : ConfigurableJackson( .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) ) -class ServerHandler(private var settings: ClientSettings) { +class ServerHandler(var settings: ClientSettings) { private val client = ApacheClient(client = HttpClients.custom() .setDefaultRequestConfig( RequestConfig.custom() @@ -121,10 +121,6 @@ class ServerHandler(private var settings: ClientSettings) { SERVER_ADDRESS_DEV } - fun setClientSettings(clientSettings: ClientSettings) { - this.settings = clientSettings - } - companion object { private val LOGGER = LoggerFactory.getLogger(ServerHandler::class.java) private val STRING_ANY_MAP_LENS = Body.auto>().toLens()