Files
Warehouse/src/main/java/com/rsscripting/rswarehouse/dao/VerifyIsChestDAO.java
T
BigPappa 293be5887a 1.4.0
Added Server Player Commands section.
2026-08-15 09:08:04 -05:00

74 lines
1.6 KiB
Java

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;
}
}