2011-05-15 19:33:03 +02:00
|
|
|
package com.Acrobot.ChestShop.Protection;
|
2011-05-15 18:16:25 +02:00
|
|
|
|
2011-07-05 19:08:55 +02:00
|
|
|
import com.Acrobot.ChestShop.Utils.uBlock;
|
2011-05-15 18:16:25 +02:00
|
|
|
import org.bukkit.block.Block;
|
2011-05-29 13:25:25 +02:00
|
|
|
import org.bukkit.block.Chest;
|
|
|
|
import org.bukkit.block.Sign;
|
2011-05-15 18:16:25 +02:00
|
|
|
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) {
|
2011-05-15 18:16:25 +02:00
|
|
|
return protection.protect(name, block);
|
|
|
|
}
|
|
|
|
|
2011-05-29 13:25:25 +02:00
|
|
|
public static boolean canAccess(Player player, Block block) {
|
2011-05-15 18:16:25 +02:00
|
|
|
return protection.canAccess(player, block);
|
|
|
|
}
|
|
|
|
|
2011-05-29 13:25:25 +02:00
|
|
|
public static boolean isProtected(Block block) {
|
2011-05-15 18:16:25 +02:00
|
|
|
return protection.isProtected(block);
|
|
|
|
}
|
2011-05-29 13:25:25 +02:00
|
|
|
|
|
|
|
public static boolean canPlaceSign(Player p, Block block) {
|
2011-07-05 19:08:55 +02:00
|
|
|
Chest chest = uBlock.findChest(block);
|
|
|
|
Sign sign1 = uBlock.findSign(chest.getBlock());
|
|
|
|
Sign sign2 = uBlock.findSign(block);
|
2011-05-29 13:25:25 +02:00
|
|
|
|
|
|
|
return (sign1 == null || sign1.getLine(0).startsWith(p.getName())) && (sign2 == null || sign2.getLine(0).startsWith(p.getName()));
|
|
|
|
}
|
2011-05-15 18:16:25 +02:00
|
|
|
}
|