UpdateCancelCommand class
Пакет: com.hypixel.hytale.server.core.update.command
Файл: com/hypixel/hytale/server/core/update/command/UpdateCancelCommand.java
extends: CommandBase
Поля (5)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
Message |
MSG_NOTHING_TO_CANCEL |
|
UpdateModule |
var2 |
|
boolean |
var3 |
|
|
var3 |
|
String |
var4 |
Методы (3)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
if if(var4 == null && !var3) |
|
|
if if(var4 != null) |
abstract |
|
super super("cancel", "server.commands.update.cancel.desc") |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.update.command;
class="kw">import com.hypixel.hytale.server.core.Message;
class="kw">import com.hypixel.hytale.server.core.command.system.CommandContext;
class="kw">import com.hypixel.hytale.server.core.command.system.basecommands.CommandBase;
class="kw">import com.hypixel.hytale.server.core.update.UpdateModule;
class="kw">import com.hypixel.hytale.server.core.update.UpdateService;
class="kw">import javax.annotation.Nonnull;
class="kw">public class UpdateCancelCommand class="kw">extends CommandBase {
class="kw">private class="kw">static class="kw">final Message MSG_NOTHING_TO_CANCEL = Message.translation("server.commands.update.nothing_to_cancel");
class="kw">private class="kw">static class="kw">final Message MSG_DOWNLOAD_CANCELLED = Message.translation("server.commands.update.download_cancelled");
class="kw">private class="kw">static class="kw">final Message MSG_CANCEL_FAILED = Message.translation("server.commands.update.cancel_failed");
class="kw">public UpdateCancelCommand() {
super("cancel", "server.commands.update.cancel.desc");
}
@Override
class="kw">protected void executeSync(@Nonnull CommandContext var1) {
UpdateModule var2 = UpdateModule.get();
boolean var3 = false;
if (var2 != null && var2.cancelDownload()) {
var1.sendMessage(MSG_DOWNLOAD_CANCELLED);
var3 = true;
}
String var4 = UpdateService.getStagedVersion();
if (var4 == null && !var3) {
var1.sendMessage(MSG_NOTHING_TO_CANCEL);
} else {
if (UpdateService.deleteStagedUpdate()) {
if (var4 != null) {
var1.sendMessage(Message.translation("server.commands.update.cancelled").param("version", var4));
}
} else if (var4 != null) {
var1.sendMessage(MSG_CANCEL_FAILED);
}
}
}
}