ChestShop-3/com/Acrobot/ChestShop/Protection/Security.java

34 lines
978 B
Java
Raw Normal View History

2011-05-15 19:33:03 +02:00
package com.Acrobot.ChestShop.Protection;
import com.Acrobot.ChestShop.Utils.uBlock;
import com.Acrobot.ChestShop.Utils.uLongName;
import org.bukkit.block.Block;
2011-05-29 13:25:25 +02:00
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
/**
* @author Acrobot
*/
public class Security {
public static Protection protection = new Default();
2011-05-29 13:25:25 +02:00
public static boolean protect(String name, Block block) {
return protection.protect(name, block);
}
2011-05-29 13:25:25 +02:00
public static boolean canAccess(Player player, Block block) {
return protection.canAccess(player, block);
}
2011-05-29 13:25:25 +02:00
public static boolean isProtected(Block block) {
return protection.isProtected(block);
}
2011-05-29 13:25:25 +02:00
public static boolean canPlaceSign(Player p, Block block) {
Sign sign = uBlock.findSign(uBlock.findChest(block).getBlock());
if (sign == null) sign = uBlock.findSign(block);
2011-05-29 13:25:25 +02:00
return (sign == null || sign.getLine(0).equals(uLongName.stripName(p.getName())));
2011-05-29 13:25:25 +02:00
}
}