package com.rsscripting.rswarehouse.dao; import com.rsscripting.rswarehouse.RSWarehouse; import com.rsscripting.rswarehouse.database.DatabaseManager; import org.bukkit.block.Block; import java.sql.Connection; import java.sql.PreparedStatement; public class VerifyIsChestDAO { public static boolean isWarehouseChest( Block block ) { try ( Connection connection = DatabaseManager.getConnection() ) { PreparedStatement statement = connection.prepareStatement( """ SELECT 1 FROM warehouse_chests WHERE world = ? AND x = ? AND y = ? AND z = ? """ ); statement.setString( 1, block.getWorld().getName() ); statement.setInt( 2, block.getX() ); statement.setInt( 3, block.getY() ); statement.setInt( 4, block.getZ() ); return statement.executeQuery().next(); } catch (Exception e) { RSWarehouse.getInstance() .getLogger() .severe( "Failed checking Community Warehouse chest registration." ); } return false; } }