package de.steamwar.bausystem.features.inventoryfiller;

import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import org.bukkit.entity.Player;

@Linked
public class InventoryFillerCommand extends SWCommand {

    public InventoryFillerCommand() {
        super("inventoryfill");
    }

    @Register(description = {"INVENTORY_FILL_HELP", "INVENTORY_FILL_INFO"})
    public void toggle(Player player) {
        boolean inventoryFill = Config.getInstance().get(player).getPlainValueOrDefault("inventoryfill", false);
        Config.getInstance().get(player).put("inventoryfill", !inventoryFill);
        if (!inventoryFill) {
            SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("INVENTORY_FILL_ENABLE", player));
            BauSystem.MESSAGE.send("INVENTORY_FILL_INFO", player);
        }else {
            SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("INVENTORY_FILL_DISABLE", player));
        }
    }
}
