Compare commits
No commits in common. "fc5b76290e7423b11d29a689eba15cc7a645dc71" and "e7075140e35e9102c9a218190a1997d6a53e27d3" have entirely different histories.
fc5b76290e
...
e7075140e3
@ -19,6 +19,7 @@ public final class Main extends JavaPlugin {
|
|||||||
private static Logger logger;
|
private static Logger logger;
|
||||||
|
|
||||||
private List<Appliance> appliances;
|
private List<Appliance> appliances;
|
||||||
|
private HttpServer httpApi;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
@ -61,7 +62,7 @@ public final class Main extends JavaPlugin {
|
|||||||
Main.logger().info(String.format("Initialized %d appliances!", appliances.size()));
|
Main.logger().info(String.format("Initialized %d appliances!", appliances.size()));
|
||||||
|
|
||||||
Main.logger().info("Starting HTTP API...");
|
Main.logger().info("Starting HTTP API...");
|
||||||
new HttpServer();
|
this.httpApi = new HttpServer();
|
||||||
|
|
||||||
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||||
Main.logger().info("Startup complete!");
|
Main.logger().info("Startup complete!");
|
||||||
@ -75,7 +76,7 @@ public final class Main extends JavaPlugin {
|
|||||||
appliance.onDisable();
|
appliance.onDisable();
|
||||||
appliance.destruct(this);
|
appliance.destruct(this);
|
||||||
});
|
});
|
||||||
|
this.httpApi.stop();
|
||||||
HandlerList.unregisterAll(this);
|
HandlerList.unregisterAll(this);
|
||||||
Bukkit.getScheduler().cancelTasks(this);
|
Bukkit.getScheduler().cancelTasks(this);
|
||||||
Main.logger().info("Disabled " + appliances.size() + " appliances!");
|
Main.logger().info("Disabled " + appliances.size() + " appliances!");
|
||||||
|
@ -24,6 +24,10 @@ public class HttpServer {
|
|||||||
Main.instance().getAppliances().forEach(appliance -> appliance.httpApi(new ApiBuilder(appliance)));
|
Main.instance().getAppliances().forEach(appliance -> appliance.httpApi(new ApiBuilder(appliance)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stop() {
|
||||||
|
Spark.stop();
|
||||||
|
}
|
||||||
|
|
||||||
public record Response(Status status, Object error, Object response) {
|
public record Response(Status status, Object error, Object response) {
|
||||||
public enum Status {
|
public enum Status {
|
||||||
FAILURE,
|
FAILURE,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user