// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.server.core.update.command;

import javax.annotation.Nullable;
import com.hypixel.hytale.server.core.update.UpdateModule;
import java.util.concurrent.CompletableFuture;
import com.hypixel.hytale.server.core.command.system.ParseResult;
import com.hypixel.hytale.server.core.command.system.ParserContext;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.core.command.system.CommandSender;
import com.hypixel.hytale.server.core.command.system.AbstractCommand;
import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.command.system.basecommands.AbstractCommandCollection;

public class UpdateCommand extends AbstractCommandCollection
{
    private static final Message MSG_DISABLED;
    
    public UpdateCommand() {
        super("update", "server.commands.update.desc");
        this.addSubCommand(new UpdateCheckCommand());
        this.addSubCommand(new UpdateDownloadCommand());
        this.addSubCommand(new UpdateApplyCommand());
        this.addSubCommand(new UpdateCancelCommand());
        this.addSubCommand(new UpdateStatusCommand());
        this.addSubCommand(new UpdatePatchlineCommand());
    }
    
    @Nullable
    @Override
    public CompletableFuture<Void> acceptCall(@Nonnull final CommandSender sender, @Nonnull final ParserContext parserContext, @Nonnull final ParseResult parseResult) {
        if (UpdateModule.KILL_SWITCH_ENABLED) {
            sender.sendMessage(UpdateCommand.MSG_DISABLED);
            return CompletableFuture.completedFuture((Void)null);
        }
        return super.acceptCall(sender, parserContext, parseResult);
    }
    
    static {
        MSG_DISABLED = Message.translation("server.commands.update.disabled");
    }
}
