Fix&Fix - Totally not testing in production
This commit is contained in:
parent
bce6aaa428
commit
4099a54ce8
1 changed files with 6 additions and 3 deletions
|
@ -27,6 +27,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
import com.sun.net.httpserver.HttpExchange;
|
||||||
import com.sun.net.httpserver.HttpHandler;
|
import com.sun.net.httpserver.HttpHandler;
|
||||||
|
import com.sun.net.httpserver.HttpServer;
|
||||||
import com.sun.net.httpserver.HttpsConfigurator;
|
import com.sun.net.httpserver.HttpsConfigurator;
|
||||||
import com.sun.net.httpserver.HttpsParameters;
|
import com.sun.net.httpserver.HttpsParameters;
|
||||||
import com.sun.net.httpserver.HttpsServer;
|
import com.sun.net.httpserver.HttpsServer;
|
||||||
|
@ -41,12 +42,12 @@ public class ButtonWebsiteModule extends JavaPlugin {
|
||||||
/**
|
/**
|
||||||
* For ACME validation and user redirection
|
* For ACME validation and user redirection
|
||||||
*/
|
*/
|
||||||
private static HttpsServer httpserver;
|
private static HttpServer httpserver;
|
||||||
|
|
||||||
public ButtonWebsiteModule() {
|
public ButtonWebsiteModule() {
|
||||||
try {
|
try {
|
||||||
server = HttpsServer.create(new InetSocketAddress((InetAddress) null, PORT), 10);
|
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");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
|
||||||
// initialise the keystore
|
// initialise the keystore
|
||||||
|
@ -130,8 +131,10 @@ public class ButtonWebsiteModule extends JavaPlugin {
|
||||||
server.setExecutor(
|
server.setExecutor(
|
||||||
new ThreadPoolExecutor(4, 8, 30, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(100)));
|
new ThreadPoolExecutor(4, 8, 30, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(100)));
|
||||||
final Calendar calendar = Calendar.getInstance();
|
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
|
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
|
((Runnable) server::start).run(); // Totally normal way of calling a method
|
||||||
httpserver.createContext("/", new HttpHandler() {
|
httpserver.createContext("/", new HttpHandler() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue