本文整理汇总了Java中com.sk89q.worldguard.protection.regions.ProtectedRegion.setPriority方法的典型用法代码示例。如果您正苦于以下问题:Java ProtectedRegion.setPriority方法的具体用法?Java ProtectedRegion.setPriority怎么用?Java ProtectedRegion.setPriority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sk89q.worldguard.protection.regions.ProtectedRegion
的用法示例。
在下文中一共展示了ProtectedRegion.setPriority方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillRegion
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
private static void fillRegion(ProtectedRegion region) {
region.setPriority(42);
region.getOwners().addPlayer(UUID.randomUUID());
region.getOwners().addGroup("owner_test_group");
region.getMembers().addPlayer(UUID.randomUUID());
region.getMembers().addGroup("member_test_group");
region.setFlag(DefaultFlag.ENTRY_DENY_MESSAGE, "Test entry deny message");
region.setFlag(DefaultFlag.BUILD, StateFlag.State.ALLOW);
region.setFlag(DefaultFlag.BLOCK_PLACE, StateFlag.State.ALLOW);
region.setFlag(DefaultFlag.NOTIFY_ENTER, true);
region.setFlag(DefaultFlag.GAME_MODE, GameMode.CREATIVE);
region.setFlag(DefaultFlag.ALLOWED_CMDS, (Set<String>) ImmutableSet.of("/test", "/mongowg"));
region.setFlag(DefaultFlag.DENY_SPAWN, (Set<EntityType>) ImmutableSet.of(EntityType.HORSE));
region.setFlag(DefaultFlag.HEAL_AMOUNT, 21);
region.setFlag(DefaultFlag.MAX_HEAL, 42.0);
}
示例2: createRegion
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
public void createRegion(ProtectedRegion region, Player p){
World world = p.getWorld();
ProtectedRegion hotelRegion = HTWorldGuardManager.getRegion(world, "hotel-" + hotel.getName());
if(!Mes.hasPerm(p, "hotels.create")){ Mes.mes(p, "chat.noPermission"); return; }
if(HTWorldGuardManager.doesRoomRegionOverlap(region, world)){ Mes.mes(p, "chat.commands.room.alreadyPresent"); return; }
if(!HTWorldGuardManager.isOwner(p, hotelRegion) && !Mes.hasPerm(p, "hotels.create.admin")){
Mes.mes(p, "chat.commands.youDoNotOwnThat"); return; }
region.setPriority(10);
HTWorldGuardManager.addRegion(world, region);
HTWorldGuardManager.roomFlags(region, num, world);
HTWorldGuardManager.makeRoomAccessible(region);
HTWorldGuardManager.saveRegions(p.getWorld());
Mes.mes(p, "chat.commands.room.success",
"%room%", String.valueOf(num),
"%hotel%", hotel.getName());
}
示例3: exec
import com.sk89q.worldguard.protection.regions.ProtectedRegion; //导入方法依赖的package包/类
@Override
public Construct exec(Target t, Environment env, Construct... args) throws CancelCommandException, ConfigRuntimeException {
Static.checkPlugin("WorldGuard", t);
World world = null;
String region;
int priority;
if (args.length == 2) {
region = args[0].val();
MCPlayer m = null;
if (env.getEnv(CommandHelperEnvironment.class).GetCommandSender() instanceof MCPlayer) {
m = env.getEnv(CommandHelperEnvironment.class).GetPlayer();
}
if (m != null) {
world = Bukkit.getServer().getWorld(m.getWorld().getName());
}
priority = Static.getInt32(args[1], t);
} else {
region = args[1].val();
world = Bukkit.getServer().getWorld(args[0].val());
priority = Static.getInt32(args[2], t);
}
if (world == null) {
throw new CREInvalidWorldException("Unknown world specified", t);
}
if ("__global__".equalsIgnoreCase(region)) {
throw new CREPluginInternalException("The region cannot be named __global__.", t);
}
RegionManager mgr = WorldGuardPlugin.inst().getRegionManager(world);
ProtectedRegion regionExists = mgr.getRegion(region);
if (regionExists == null) {
throw new CREPluginInternalException(String.format("The region (%s) does not exist in world (%s).", region, world.getName()), t);
}
regionExists.setPriority(priority);
try {
mgr.save();
} catch (StorageException e) {
throw new CREPluginInternalException("Error while setting priority for protected region", t, e);
}
return CVoid.VOID;
}