mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-12-11 11:09:56 +01:00
42 lines
1014 B
Java
42 lines
1014 B
Java
package com.Acrobot.Breeze.Utils;
|
|
|
|
import org.bukkit.Material;
|
|
import org.bukkit.block.Block;
|
|
import org.bukkit.block.Sign;
|
|
import org.bukkit.material.Attachable;
|
|
|
|
/**
|
|
* @author Acrobot
|
|
*/
|
|
public class BlockUtil {
|
|
/**
|
|
* Checks if the block is a sign
|
|
*
|
|
* @param block Block to check
|
|
* @return Is this block a sign?
|
|
*/
|
|
public static boolean isSign(Block block) {
|
|
return block.getState() instanceof Sign;
|
|
}
|
|
|
|
/**
|
|
* Checks if the block is a chest
|
|
*
|
|
* @param block Block to check
|
|
* @return Is this block a chest?
|
|
*/
|
|
public static boolean isChest(Block block) {
|
|
return block.getType() == Material.CHEST;
|
|
}
|
|
|
|
/**
|
|
* Gets the block to which the sign is attached
|
|
*
|
|
* @param sign Sign which is attached
|
|
* @return Block to which the sign is attached
|
|
*/
|
|
public static Block getAttachedFace(Sign sign) {
|
|
return sign.getBlock().getRelative(((Attachable) sign.getData()).getAttachedFace());
|
|
}
|
|
}
|