プラグインでラージチェストの判断方法
public static boolean chkChestState(Block block){
BlockState state = block.getState();
if(state instanceof org.bukkit.block.Chest) {
Chest chest = (Chest) state;
if (chest.getInventory().getHolder() instanceof DoubleChest) {
Bukkit.getConsoleSender().sendMessage("DoubleChest");
DoubleChest doubleChest =(DoubleChest) chest.getInventory().getHolder();
InventoryHolder leftChestHolder = doubleChest.getLeftSide();
InventoryHolder rightChestHolder = doubleChest.getRightSide();
if(leftChestHolder instanceof Chest){
Chest leftChest = (Chest) leftChestHolder;
if(leftChest.getCustomName() != null && leftChest.getCustomName().equals("カスタムネーム")){
Bukkit.getConsoleSender().sendMessage("Custom_DoubleChest");
return true;
}
}
if(rightChestHolder instanceof Chest){
Chest rightChest = (Chest) rightChestHolder;
if (rightChest.getCustomName() != null && rightChest.getCustomName().equals(PUBLIC)) {
Bukkit.getConsoleSender().sendMessage("Custom_DoubleChest");
return true;
}
}
} else {
Bukkit.getConsoleSender().sendMessage("SingleChest");
if (chest.getCustomName() != null && chest.getCustomName().equals("カスタムネーム")) {
Bukkit.getConsoleSender().sendMessage("Custom_SingleChest");
return true;
}
}
return true;
}
return false;
}
これを使って、チェストとラージチェストを判断する。
if分でor(||)を使えば、もっといい感じになりそう。