From 4099a54ce80377281e6dccb1487f168ce45245ce Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sat, 25 Nov 2017 01:59:35 +0100 Subject: [PATCH] Fix&Fix - Totally not testing in production --- src/buttondevteam/website/ButtonWebsiteModule.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/buttondevteam/website/ButtonWebsiteModule.java b/src/buttondevteam/website/ButtonWebsiteModule.java index 5ad5ce4..47877b3 100644 --- a/src/buttondevteam/website/ButtonWebsiteModule.java +++ b/src/buttondevteam/website/ButtonWebsiteModule.java @@ -27,6 +27,7 @@ import org.bukkit.plugin.java.JavaPlugin; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; import com.sun.net.httpserver.HttpsConfigurator; import com.sun.net.httpserver.HttpsParameters; import com.sun.net.httpserver.HttpsServer; @@ -41,12 +42,12 @@ public class ButtonWebsiteModule extends JavaPlugin { /** * For ACME validation and user redirection */ - private static HttpsServer httpserver; + private static HttpServer httpserver; public ButtonWebsiteModule() { try { server = HttpsServer.create(new InetSocketAddress((InetAddress) null, PORT), 10); - httpserver = HttpsServer.create(new InetSocketAddress((InetAddress) null, 80), 10); + httpserver = HttpServer.create(new InetSocketAddress((InetAddress) null, 80), 10); SSLContext sslContext = SSLContext.getInstance("TLS"); // initialise the keystore @@ -130,8 +131,10 @@ public class ButtonWebsiteModule extends JavaPlugin { server.setExecutor( new ThreadPoolExecutor(4, 8, 30, TimeUnit.SECONDS, new ArrayBlockingQueue(100))); final Calendar calendar = Calendar.getInstance(); - if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY && !TBMCCoreAPI.IsTestServer()) // Only update every week + if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY && !TBMCCoreAPI.IsTestServer()) { // Only update every week + Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); AcmeClient.main("server.figytuna.com"); // Task is running async so we don't need an extra thread + } ((Runnable) server::start).run(); // Totally normal way of calling a method httpserver.createContext("/", new HttpHandler() { @Override