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

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

import java.util.Set;
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 WhitelistClearCommand extends CommandBase
{
    @Nonnull
    private static final Message MESSAGE_MODULES_WHITELIST_CLEARED;
    @Nonnull
    private final HytaleWhitelistProvider whitelistProvider;
    
    public WhitelistClearCommand(@Nonnull final HytaleWhitelistProvider whitelistProvider) {
        super("clear", "server.commands.whitelist.clear.desc");
        this.whitelistProvider = whitelistProvider;
    }
    
    @Override
    protected void executeSync(@Nonnull final CommandContext context) {
        this.whitelistProvider.modify(list -> {
            list.clear();
            return Boolean.valueOf(true);
        });
        context.sendMessage(WhitelistClearCommand.MESSAGE_MODULES_WHITELIST_CLEARED);
    }
    
    static {
        MESSAGE_MODULES_WHITELIST_CLEARED = Message.translation("server.modules.whitelist.cleared");
    }
}
