本文整理汇总了Java中com.griefcraft.lwc.LWC类的典型用法代码示例。如果您正苦于以下问题:Java LWC类的具体用法?Java LWC怎么用?Java LWC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LWC类属于com.griefcraft.lwc包,在下文中一共展示了LWC类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeLWC
import com.griefcraft.lwc.LWC; //导入依赖的package包/类
/**
* Remove any LWC Data that may be on the plot.
*/
public void removeLWC(final Plot plot) {
final int x1 = plot.getBottomX();
final int z1 = plot.getBottomZ();
final int x2 = plot.getTopX();
final int z2 = plot.getBottomZ();
plugin.getServerBridge().runTaskAsynchronously(new Runnable() {
@Override
public void run() {
LWC lwc = LWC.getInstance();
List<Protection> protections = lwc.getPhysicalDatabase().loadProtections(plot.getWorld().getName(), x1, x2, 0, 256, z1, z2);
for (Protection protection : protections) {
protection.remove();
}
}
});
}
示例2: setInvProtectionType
import com.griefcraft.lwc.LWC; //导入依赖的package包/类
/**
* Set the inventory protection method to be used by STB. If a type of
* BEST is supplied, STB will choose the best available protection method.
*
* @param invProtectionType the desired protection type
*/
public void setInvProtectionType(InvProtectionType invProtectionType) {
switch (invProtectionType) {
case BEST:
if (SensibleToolbox.getPluginInstance().getLWC() != null) {
this.invProtectionType = InvProtectionType.LWC;
} else if (SensibleToolbox.getPluginInstance().isWorldGuardAvailable()) {
this.invProtectionType = InvProtectionType.WORLDGUARD;
} else {
this.invProtectionType = InvProtectionType.NONE;
}
break;
default:
if (invProtectionType.isAvailable()) {
this.invProtectionType = invProtectionType;
} else {
LogUtils.warning("Inventory protection type " + invProtectionType + " is not available");
this.invProtectionType = InvProtectionType.NONE;
}
break;
}
Debugger.getInstance().debug("Using inventory protection method: " + this.invProtectionType);
}
示例3: 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;
}
}
示例4: 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());
}
示例5: loadLWC
import com.griefcraft.lwc.LWC; //导入依赖的package包/类
/**
* load / reload the instance of LWC
*/
public void loadLWC() {
if (manager.isPluginEnabled("LWC")) {
lwc = LWC.getInstance();
PluginDescriptionFile desc = lwc.getPlugin().getDescription();
lwcIntegration = new LWCIntegration();
MessageUtil.log(this, "Successfully hooked into " + desc.getName() + " v" + desc.getVersion() + ".");
} else {
MessageUtil.log(this, "&4Could not find LWC.");
}
}
示例6: canAccess
import com.griefcraft.lwc.LWC; //导入依赖的package包/类
private boolean canAccess(Player p, Block b){
if(!LWC.getInstance().isProtectable(b)) return true;
return LWC.getInstance().getProtectionCache().getProtection(b) == null || LWC.getInstance().canAccessProtection(p, b);
}
示例7: getLWC
import com.griefcraft.lwc.LWC; //导入依赖的package包/类
public LWC getLWC() {
return lwc;
}
示例8: isOwner
import com.griefcraft.lwc.LWC; //导入依赖的package包/类
public static boolean isOwner(Player p, Block block) {
LWC api = ((LWCPlugin) Bukkit.getPluginManager().getPlugin("LWC")).getLWC();
return api.canAccessProtection(p, block);
}
示例9: 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();
}
示例10: getLWC
import com.griefcraft.lwc.LWC; //导入依赖的package包/类
/**
* @return
* the loaded instance of LWC
*/
public LWC getLWC() {
return lwc;
}
示例11: isAvailable
import com.griefcraft.lwc.LWC; //导入依赖的package包/类
public boolean isAvailable() {
switch (this) {
case WORLDGUARD: return SensibleToolbox.getPluginInstance().isWorldGuardAvailable();
case LWC: return SensibleToolbox.getPluginInstance().getLWC() != null;
default: return true;
}
}