More refractoring

This commit is contained in:
Acrobot 2012-12-22 21:04:48 +01:00
parent 841a67a54b
commit d0ce8419e7
2 changed files with 14 additions and 10 deletions

View File

@ -1,5 +1,6 @@
package com.Acrobot.Breeze.Utils;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.material.Attachable;
@ -18,6 +19,16 @@ public class BlockUtil {
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
*

View File

@ -1,11 +1,9 @@
package com.Acrobot.ChestShop.Plugins;
import com.Acrobot.Breeze.Utils.BlockUtil;
import com.Acrobot.ChestShop.Events.Protection.ProtectionCheckEvent;
import com.Acrobot.ChestShop.Signs.ChestShopSign;
import com.Acrobot.ChestShop.Utils.uBlock;
import com.Acrobot.ChestShop.Utils.uName;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Chest;
import org.bukkit.block.Sign;
@ -14,6 +12,9 @@ import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import static com.Acrobot.Breeze.Utils.BlockUtil.isChest;
import static com.Acrobot.Breeze.Utils.BlockUtil.isSign;
/**
* @author Acrobot
*/
@ -60,14 +61,6 @@ public class ChestShop implements Listener {
return true;
}
private static boolean isChest(Block block) {
return block.getType() == Material.CHEST;
}
private static boolean isSign(Block block) {
return BlockUtil.isSign(block);
}
private static boolean canBeProtected(Block block) {
return isSign(block) || isChest(block);
}