本文整理汇总了Java中com.sk89q.worldguard.bukkit.RegionContainer类的典型用法代码示例。如果您正苦于以下问题:Java RegionContainer类的具体用法?Java RegionContainer怎么用?Java RegionContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegionContainer类属于com.sk89q.worldguard.bukkit包,在下文中一共展示了RegionContainer类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:lucko,项目名称:ConditionalPerms,代码行数:17,代码来源:WorldGuardHook.java
示例2: worldGuardClaim
import com.sk89q.worldguard.bukkit.RegionContainer; //导入依赖的package包/类
public boolean worldGuardClaim(Location loc) {
if (wild.getConfig().getBoolean("WorldGuard")) {
WorldGuardPlugin wg = (WorldGuardPlugin) Bukkit.getServer()
.getPluginManager().getPlugin("WorldGuard");
RegionContainer container = wg.getRegionContainer();
if(container==null)
return true;
RegionManager regions = container.get(loc.getWorld());
ApplicableRegionSet set = regions.getApplicableRegions(loc);
if (!set.getRegions().isEmpty())
return true;
else
return false;
} else
return false;
}
开发者ID:Qballl,项目名称:WildernessTp,代码行数:22,代码来源:ClaimChecks.java
示例3: injectRegionDriver
import com.sk89q.worldguard.bukkit.RegionContainer; //导入依赖的package包/类
/**
* Injects a new {@code RegionDriver} in the given {@code RegionContainer}.
*
* @param container The {@code RegionContainer} in which should be injected
* @param driver The {@code RegionDriver} which should be injected
* @throws RuntimeException Encapsulated {@link ReflectiveOperationException}
*/
public static void injectRegionDriver(RegionContainer container, RegionDriver driver) {
try {
Field field = RegionContainer.class.getDeclaredField("container");
field.setAccessible(true);
field.set(container, new RegionContainerImpl(driver));
} catch (ReflectiveOperationException e) {
throw Throwables.propagate(e);
}
}
开发者ID:maxikg,项目名称:mongowg,代码行数:17,代码来源:InjectionUtils.java
示例4: saveInvoke
import com.sk89q.worldguard.bukkit.RegionContainer; //导入依赖的package包/类
private static void saveInvoke(Object object, String name) {
try {
Method method = RegionContainer.class.getDeclaredMethod(name);
method.setAccessible(true);
method.invoke(object);
} catch (ReflectiveOperationException e) {
throw Throwables.propagate(e);
}
}
开发者ID:maxikg,项目名称:mongowg,代码行数:10,代码来源:InjectionUtils.java
示例5: onEnable
import com.sk89q.worldguard.bukkit.RegionContainer; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void onEnable() {
saveDefaultConfig();
CodecRegistry codecRegistry = createCodecRegistry();
MongoClientSettings settings = MongoClientSettings.builder()
.clusterSettings(ClusterSettings.builder().applyConnectionString(new ConnectionString(getConfig().getString("mongodb.uri"))).build())
.codecRegistry(codecRegistry)
.build();
client = MongoClients.create(settings);
MongoDatabase database = client.getDatabase(getConfig().getString("mongodb.database"));
if (!testConnection(database))
return;
RegionStorageAdapter storageAdapter = new RegionStorageAdapter(database);
MongoRegionDriver driver = new MongoRegionDriver(getServer(), storageAdapter);
WorldGuardPlugin wgPlugin = WorldGuardPlugin.inst();
if (getConfig().getBoolean("mongodb.use_oplog")) {
getLogger().info("OpLog usage enabled.");
WorldGuardOpLogHandler opLogHandler = new WorldGuardOpLogHandler(codecRegistry.get(ProcessingProtectedRegion.class), storageAdapter, wgPlugin);
getServer().getScheduler().runTaskAsynchronously(this, new OpLogRetriever(
OpLogUtils.getCollection(client),
new OpLogParser(opLogHandler),
getConfig().getString("mongodb.database") + "." + RegionStorageAdapter.COLLECTION_NAME
));
storageAdapter.setListener(opLogHandler);
}
ConfigurationManager config = wgPlugin.getGlobalStateManager();
RegionContainer container = wgPlugin.getRegionContainer();
InjectionUtils.injectRegionDriver(container, driver);
InjectionUtils.callUnload(container);
InjectionUtils.callLoadWorlds(container);
config.selectedRegionStoreDriver = driver;
}
开发者ID:maxikg,项目名称:mongowg,代码行数:39,代码来源:MongoWGPlugin.java
示例6: 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;
}
开发者ID:EpicEricEE,项目名称:ShopChest,代码行数:35,代码来源:WorldGuardListener.java
示例7: WorldGuardWorldInheritance
import com.sk89q.worldguard.bukkit.RegionContainer; //导入依赖的package包/类
public WorldGuardWorldInheritance(Plugin plugin) throws NoSuchFieldException {
this.worldGuard = (WorldGuardPlugin) plugin;
this.regionContainerContainer = RegionContainer.class.getDeclaredField("container");
this.regionContainerContainer.setAccessible(true);
this.regionContainerImplMapping = RegionContainerImpl.class.getDeclaredField("mapping");
this.regionContainerImplMapping.setAccessible(true);
}
开发者ID:cybertiger,项目名称:Bukkit-Instances,代码行数:8,代码来源:WorldGuardWorldInheritanceFactory.java
示例8: preAddInheritance
import com.sk89q.worldguard.bukkit.RegionContainer; //导入依赖的package包/类
public void preAddInheritance(String parent, String child) {
try {
RegionContainer regionContainer = worldGuard.getRegionContainer();
RegionContainerImpl regionContainerImpl = (RegionContainerImpl) regionContainerContainer.get(regionContainer);
RegionManager parentRegionManager = regionContainerImpl.get(parent);
if (parentRegionManager != null) {
Normal childNormal = Normal.normal(child);
ConcurrentMap<Normal, RegionManager> mapping = (ConcurrentMap<Normal, RegionManager>) regionContainerImplMapping.get(regionContainerImpl);
mapping.putIfAbsent(childNormal, parentRegionManager);
}
} catch (IllegalArgumentException | IllegalAccessException ex) {
getThisPlugin().getLogger().log(Level.WARNING, null, ex);
}
}
开发者ID:cybertiger,项目名称:Bukkit-Instances,代码行数:15,代码来源:WorldGuardWorldInheritanceFactory.java
示例9: preRemoveInheritance
import com.sk89q.worldguard.bukkit.RegionContainer; //导入依赖的package包/类
public void preRemoveInheritance(String parent, String child) {
try {
RegionContainer regionContainer = worldGuard.getRegionContainer();
RegionContainerImpl regionContainerImpl = (RegionContainerImpl) regionContainerContainer.get(regionContainer);
RegionManager parentRegionManager = regionContainerImpl.get(parent);
Normal childNormal = Normal.normal(child);
ConcurrentMap<Normal, RegionManager> mapping = (ConcurrentMap<Normal, RegionManager>) regionContainerImplMapping.get(regionContainerImpl);
if (mapping.get(childNormal) == parentRegionManager) {
// Dont force save
mapping.remove(childNormal);
}
} catch (IllegalArgumentException | IllegalAccessException ex) {
getThisPlugin().getLogger().log(Level.WARNING, null, ex);
}
}
开发者ID:cybertiger,项目名称:Bukkit-Instances,代码行数:16,代码来源:WorldGuardWorldInheritanceFactory.java
示例10: WorldguardCheck
import com.sk89q.worldguard.bukkit.RegionContainer; //导入依赖的package包/类
/**
* Checks if the player is in, or near the specified WorldGuard regions.
* @param l The location to check.
* @return True or False, Is the location in one of these regions.
*/
public boolean WorldguardCheck(final Location l) {
//Checks if plugin is installed.
if (Bukkit.getServer().getPluginManager().getPlugin("WorldGuard") != null) {
//Checks if WorldGuard is enabled
if (RandomCoords.getPlugin().config.getString("WorldGuard").equals("true")) {
final int X = l.getBlockX();
// int Y = l.getBlockY();
final int Z = l.getBlockZ();
//Calls the BufferZone
final int r = RandomCoords.getPlugin().config.getInt("CheckingRadius");
//Checks all coordinates within the buffer zone for a region
//See if allRegions is enabled.
if (RandomCoords.getPlugin().config.getStringList("Regions").contains("allRegions")) {
return RandomCoords.getPlugin().getWorldGuard().getRegionManager(l.getWorld()).getApplicableRegions(l).size() == 0;
} else {
RegionContainer container = RandomCoords.getPlugin().getWorldGuard().getRegionContainer();
RegionManager regions = container.get(l.getWorld());
int cub = RandomCoords.getPlugin().config.getInt("CheckingRadius");
BlockVector p1 = new BlockVector(l.getX() + cub, 0.0D, l.getZ() + cub);
BlockVector p2 = new BlockVector(l.getX() - cub, 256.0D, l.getZ() - cub);
ProtectedRegion cuboid = new ProtectedCuboidRegion("RandomCoordsREGION-DO-NOT-USE", p1, p2);
ProtectedRegion regionRadius = cuboid;
ApplicableRegionSet set = regions.getApplicableRegions(regionRadius);
if(set.size() == 0 ) {
return true;
}
List<String> regionsToCheck = new ArrayList<>();
for(String name : RandomCoords.getPlugin().config.getStringList("Regions")) {
if (set.getRegions().contains(regions.getRegion(name))) {
regionsToCheck.add(name);
}
}
return regionsToCheck == null || regionsToCheck.size() == 0;
}
}
return true;
} else {
return true;
}
}
开发者ID:jolbol1,项目名称:RandomCoordinatesV2,代码行数:65,代码来源:WorldGuardCheck.java
示例11: callUnload
import com.sk89q.worldguard.bukkit.RegionContainer; //导入依赖的package包/类
/**
* Calls {@code RegionContainer.callUnload()} via reflection.
*
* @param container The {@code RegionContainer} on which {@code callUnload()} should be called
* @throws RuntimeException Encapsulated {@link ReflectiveOperationException}
*/
public static void callUnload(RegionContainer container) {
saveInvoke(container, "unload");
}
开发者ID:maxikg,项目名称:mongowg,代码行数:10,代码来源:InjectionUtils.java
示例12: callLoadWorlds
import com.sk89q.worldguard.bukkit.RegionContainer; //导入依赖的package包/类
/**
* Calls {@code RegionContainer.callLoadWorlds()} via reflection.
*
* @param container The {@code RegionContainer} on which {@code callLoadWorlds()} should be called
* @throws RuntimeException Encapsulated {@link ReflectiveOperationException}
*/
public static void callLoadWorlds(RegionContainer container) {
saveInvoke(container, "loadWorlds");
}
开发者ID:maxikg,项目名称:mongowg,代码行数:10,代码来源:InjectionUtils.java
注:本文中的com.sk89q.worldguard.bukkit.RegionContainer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论