本文整理汇总了Java中com.sk89q.worldguard.bukkit.RegionContainer.createQuery方法的典型用法代码示例。如果您正苦于以下问题:Java RegionContainer.createQuery方法的具体用法?Java RegionContainer.createQuery怎么用?Java RegionContainer.createQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sk89q.worldguard.bukkit.RegionContainer
的用法示例。
在下文中一共展示了RegionContainer.createQuery方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: queryRegions
import com.sk89q.worldguard.bukkit.RegionContainer; //导入方法依赖的package包/类
private Set<String> queryRegions(Location location) {
RegionContainer container = worldGuard.getRegionContainer();
RegionQuery query = container.createQuery();
ApplicableRegionSet set = query.getApplicableRegions(location);
if (set.size() == 0) {
return Collections.emptySet();
}
final Set<String> regions = new HashSet<>();
for (ProtectedRegion r : set.getRegions()) {
regions.add(r.getId().toLowerCase());
}
return regions;
}
示例2: isAllowed
import com.sk89q.worldguard.bukkit.RegionContainer; //导入方法依赖的package包/类
private boolean isAllowed(Player player, Location location, Action action) {
LocalPlayer localPlayer = worldGuard.wrapPlayer(player);
RegionContainer container = worldGuard.getRegionContainer();
RegionQuery query = container.createQuery();
Shop shop = plugin.getShopUtils().getShop(location);
if (action == Action.RIGHT_CLICK_BLOCK && shop != null) {
if (shop.getVendor().getUniqueId().equals(player.getUniqueId()) && shop.getShopType() != Shop.ShopType.ADMIN) {
return true;
}
if (!shop.getVendor().getUniqueId().equals(player.getUniqueId()) && player.isSneaking()) {
return player.hasPermission(Permissions.OPEN_OTHER);
}
}
if (ClickType.getPlayerClickType(player) != null) {
switch (ClickType.getPlayerClickType(player).getClickType()) {
case CREATE:
return query.testState(location, localPlayer, WorldGuardShopFlag.CREATE_SHOP);
case REMOVE:
case INFO:
return true;
}
} else {
if (shop != null) {
StateFlag flag = (shop.getShopType() == Shop.ShopType.NORMAL ? WorldGuardShopFlag.USE_SHOP : WorldGuardShopFlag.USE_ADMIN_SHOP);
return query.testState(location, localPlayer, flag);
}
}
return false;
}