package shop.morpheusnox.backpackInfinita;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import java.io.IOException;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class BackpackCommand implements CommandExecutor {

    private final BackpackInfinita plugin;

    public BackpackCommand(BackpackInfinita plugin) {
        this.plugin = plugin;
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(sender instanceof Player)) {
            sender.sendMessage("Este comando só pode ser usado por jogadores.");
            return true;
        }

        Player player = (Player) sender;
        Backpack backpack = plugin.getPlayerBackpack(player);
        backpack.open();

        return true;
    }
}
