parent
b2fe8492d8
commit
073f01740f
|
@ -26,11 +26,15 @@ import net.szum123321.textile_backup.Statics;
|
||||||
|
|
||||||
public class KillRestoreCommand {
|
public class KillRestoreCommand {
|
||||||
public static LiteralArgumentBuilder<ServerCommandSource> register() {
|
public static LiteralArgumentBuilder<ServerCommandSource> register() {
|
||||||
return CommandManager.literal("kill_r") //TODO: come up with something better
|
return CommandManager.literal("killR")
|
||||||
.executes(ctx -> {
|
.executes(ctx -> {
|
||||||
if(Statics.restoreAwaitThread != null && Statics.restoreAwaitThread.isAlive()) {
|
if(Statics.restoreAwaitThread != null && Statics.restoreAwaitThread.isAlive()) {
|
||||||
Statics.restoreAwaitThread.interrupt();
|
Statics.restoreAwaitThread.interrupt();
|
||||||
ctx.getSource().sendFeedback(new LiteralText("Backup restoration successfully stopped"), false);
|
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 {
|
} else {
|
||||||
ctx.getSource().sendFeedback(new LiteralText("Failed to stop backup restoration"), false);
|
ctx.getSource().sendFeedback(new LiteralText("Failed to stop backup restoration"), false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class AwaitThread extends Thread {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(delay * 1000);
|
Thread.sleep(delay * 1000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
Statics.LOGGER.info("Backup restoration cancelled.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue