mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2025-01-06 23:27:55 +01:00
35 lines
1.0 KiB
Java
35 lines
1.0 KiB
Java
package com.Acrobot.ChestShop.Protection;
|
|
|
|
import com.Acrobot.ChestShop.Utils.SearchForBlock;
|
|
import org.bukkit.block.Block;
|
|
import org.bukkit.block.Chest;
|
|
import org.bukkit.block.Sign;
|
|
import org.bukkit.entity.Player;
|
|
|
|
/**
|
|
* @author Acrobot
|
|
*/
|
|
public class Security {
|
|
public static Protection protection = new Default();
|
|
|
|
public static boolean protect(String name, Block block) {
|
|
return protection.protect(name, block);
|
|
}
|
|
|
|
public static boolean canAccess(Player player, Block block) {
|
|
return protection.canAccess(player, block);
|
|
}
|
|
|
|
public static boolean isProtected(Block block) {
|
|
return protection.isProtected(block);
|
|
}
|
|
|
|
public static boolean canPlaceSign(Player p, Block block) {
|
|
Chest chest = SearchForBlock.findChest(block);
|
|
Sign sign1 = SearchForBlock.findSign(chest.getBlock());
|
|
Sign sign2 = SearchForBlock.findSign(block);
|
|
|
|
return (sign1 == null || sign1.getLine(0).startsWith(p.getName())) && (sign2 == null || sign2.getLine(0).startsWith(p.getName()));
|
|
}
|
|
}
|