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

package com.hypixel.hytale.server.core.modules.accesscontrol.commands;

import com.hypixel.hytale.server.core.command.system.CommandContext;
import com.hypixel.hytale.server.core.modules.accesscontrol.provider.HytaleWhitelistProvider;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.command.system.basecommands.CommandBase;

public class WhitelistDisableCommand extends CommandBase
{
    @Nonnull
    private static final Message MESSAGE_MODULES_WHITELIST_DISABLED;
    @Nonnull
    private static final Message MESSAGE_MODULES_WHITELIST_ALREADY_DISABLED;
    @Nonnull
    private final HytaleWhitelistProvider whitelistProvider;
    
    public WhitelistDisableCommand(@Nonnull final HytaleWhitelistProvider whitelistProvider) {
        super("disable", "server.commands.whitelist.disable.desc");
        this.addAliases("off");
        this.setUnavailableInSingleplayer(true);
        this.whitelistProvider = whitelistProvider;
    }
    
    @Override
    protected void executeSync(@Nonnull final CommandContext context) {
        if (this.whitelistProvider.isEnabled()) {
            this.whitelistProvider.setEnabled(false);
            context.sendMessage(WhitelistDisableCommand.MESSAGE_MODULES_WHITELIST_DISABLED);
        }
        else {
            context.sendMessage(WhitelistDisableCommand.MESSAGE_MODULES_WHITELIST_ALREADY_DISABLED);
        }
    }
    
    static {
        MESSAGE_MODULES_WHITELIST_DISABLED = Message.translation("server.modules.whitelist.disabled");
        MESSAGE_MODULES_WHITELIST_ALREADY_DISABLED = Message.translation("server.modules.whitelist.alreadyDisabled");
    }
}
