diff --git a/bot/src/main/java/de/chojo/gamejam/api/v1/Server.java b/bot/src/main/java/de/chojo/gamejam/api/v1/Server.java index 1f95f5d..1592053 100644 --- a/bot/src/main/java/de/chojo/gamejam/api/v1/Server.java +++ b/bot/src/main/java/de/chojo/gamejam/api/v1/Server.java @@ -36,7 +36,7 @@ public void routes() { return; } - if(!ctx.contentType().equals("application/octet-stream")) { + if (!ctx.contentType().equals("application/octet-stream")) { ctx.status(HttpCode.BAD_REQUEST); ctx.result("Use Content-Type: application/octet-stream"); return; @@ -56,7 +56,12 @@ public void routes() { } ctx.status(HttpCode.ACCEPTED); - teamServer.restart(); + String restart = ctx.queryParam("restart"); + if ("true".equals(restart) && teamServer.running()) { + teamServer.restart(); + } else if (teamServer.running()) { + teamServer.send("say Plugin Updated"); + } }); }); } diff --git a/bot/src/main/java/de/chojo/gamejam/commands/server/system/Delete.java b/bot/src/main/java/de/chojo/gamejam/commands/server/system/Delete.java index 698d83f..75ed3e0 100644 --- a/bot/src/main/java/de/chojo/gamejam/commands/server/system/Delete.java +++ b/bot/src/main/java/de/chojo/gamejam/commands/server/system/Delete.java @@ -27,8 +27,11 @@ public Delete(Server server) { @Override public void onSlashCommand(SlashCommandInteractionEvent event, EventContext context) { var optServer = server.getServer(event, context); - if(optServer.isEmpty())return; + if (optServer.isEmpty()) return; var teamServer = optServer.get(); + if(teamServer.running()){ + teamServer.stop().join(); + } boolean deleted; try { deleted = teamServer.purge();