本文整理汇总了Java中com.griefcraft.lwc.LWC.findProtection方法的典型用法代码示例。如果您正苦于以下问题:Java LWC.findProtection方法的具体用法?Java LWC.findProtection怎么用?Java LWC.findProtection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.griefcraft.lwc.LWC
的用法示例。
在下文中一共展示了LWC.findProtection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isInventoryAccessible
import com.griefcraft.lwc.LWC; //导入方法依赖的package包/类
/**
* Check if the given player has access rights for the given block.
*
* @param player player to check
* @param block block to check
* @return true if the player may access the block's contents
*/
public boolean isInventoryAccessible(Player player, Block block) {
switch (invProtectionType) {
case LWC:
LWC lwc = SensibleToolboxPlugin.getInstance().getLWC();
Protection prot = lwc.findProtection(block);
if (prot != null) {
boolean ok = lwc.canAccessProtection(player, prot);
Debugger.getInstance().debug(2, "LWC check: can " + player.getName() + " access " + block + "? " + ok);
return ok;
} else {
return true;
}
case WORLDGUARD:
ApplicableRegionSet set = WGBukkit.getRegionManager(block.getWorld()).getApplicableRegions(block.getLocation());
return set.allows(DefaultFlag.CHEST_ACCESS, WGBukkit.getPlugin().wrapPlayer(player));
case BEST:
throw new IllegalArgumentException("should never get here!");
default:
return true;
}
}
示例2: protectChest
import com.griefcraft.lwc.LWC; //导入方法依赖的package包/类
void protectChest(CraftoPlayer owner, Block chestBlock) {
LWCPlugin lwcPlugin = (LWCPlugin) Bukkit.getPluginManager().getPlugin("LWC");
LWC lwc = lwcPlugin.getLWC();
Protection protection = lwc.findProtection(chestBlock);
if (protection != null) {
// delete
protection.remove();
}
lwc.getPhysicalDatabase().registerProtection(54,
Protection.Type.PRIVATE,
chestBlock.getWorld().getName(),
owner.getUniqueId().toString(),
null,
chestBlock.getX(),
chestBlock.getY(),
chestBlock.getZ());
}
示例3: removeProtection
import com.griefcraft.lwc.LWC; //导入方法依赖的package包/类
public static void removeProtection(Block block) {
LWC api = ((LWCPlugin) Bukkit.getPluginManager().getPlugin("LWC")).getLWC();
Protection protect = api.findProtection(block);
protect.remove();
}