kill_r command now logs who called it.

Changed kill_r to killR
This commit is contained in:
szymon 2020-08-05 20:34:54 +02:00
parent b2fe8492d8
commit 073f01740f
2 changed files with 6 additions and 1 deletions

View File

@ -26,11 +26,15 @@ import net.szum123321.textile_backup.Statics;
public class KillRestoreCommand {
public static LiteralArgumentBuilder<ServerCommandSource> register() {
return CommandManager.literal("kill_r") //TODO: come up with something better
return CommandManager.literal("killR")
.executes(ctx -> {
if(Statics.restoreAwaitThread != null && Statics.restoreAwaitThread.isAlive()) {
Statics.restoreAwaitThread.interrupt();
ctx.getSource().sendFeedback(new LiteralText("Backup restoration successfully stopped"), false);
Statics.LOGGER.info("{} cancelled backup restoration.", ctx.getSource().getEntity() != null ?
"Player: " + ctx.getSource().getName() :
"SERVER"
);
} else {
ctx.getSource().sendFeedback(new LiteralText("Failed to stop backup restoration"), false);
}

View File

@ -37,6 +37,7 @@ public class AwaitThread extends Thread {
try {
Thread.sleep(delay * 1000);
} catch (InterruptedException e) {
Statics.LOGGER.info("Backup restoration cancelled.");
return;
}