diff --git a/common/src/main/java/me/lucko/luckperms/common/plugin/AbstractLuckPermsPlugin.java b/common/src/main/java/me/lucko/luckperms/common/plugin/AbstractLuckPermsPlugin.java index 9bb3b7c1a..e986a0dd5 100644 --- a/common/src/main/java/me/lucko/luckperms/common/plugin/AbstractLuckPermsPlugin.java +++ b/common/src/main/java/me/lucko/luckperms/common/plugin/AbstractLuckPermsPlugin.java @@ -91,6 +91,7 @@ public abstract class AbstractLuckPermsPlugin implements LuckPermsPlugin { private PermissionRegistry permissionRegistry; private LogDispatcher logDispatcher; private LuckPermsConfiguration configuration; + private OkHttpClient httpClient; private BytebinClient bytebin; private BytesocksClient bytesocks; private WebEditorStore webEditorStore; @@ -134,12 +135,12 @@ public abstract class AbstractLuckPermsPlugin implements LuckPermsPlugin { this.configuration = new LuckPermsConfiguration(this, provideConfigurationAdapter()); // setup a bytebin instance - OkHttpClient httpClient = new OkHttpClient.Builder() + this.httpClient = new OkHttpClient.Builder() .callTimeout(15, TimeUnit.SECONDS) .build(); - this.bytebin = new BytebinClient(httpClient, getConfiguration().get(ConfigKeys.BYTEBIN_URL), "luckperms"); - this.bytesocks = new BytesocksClient(httpClient, getConfiguration().get(ConfigKeys.BYTESOCKS_HOST), "luckperms/editor"); + this.bytebin = new BytebinClient(this.httpClient, getConfiguration().get(ConfigKeys.BYTEBIN_URL), "luckperms"); + this.bytesocks = new BytesocksClient(this.httpClient, getConfiguration().get(ConfigKeys.BYTESOCKS_HOST), "luckperms/editor"); this.webEditorStore = new WebEditorStore(this); // init translation repo and update bundle files @@ -273,6 +274,10 @@ public abstract class AbstractLuckPermsPlugin implements LuckPermsPlugin { // shutdown async executor pool getBootstrap().getScheduler().shutdownExecutor(); + // shutdown okhttp + this.httpClient.dispatcher().executorService().shutdown(); + this.httpClient.connectionPool().evictAll(); + // close classpath appender getBootstrap().getClassPathAppender().close();