當前位置: 首頁>>代碼示例>>Java>>正文


Java ProtectedRegion.setPriority方法代碼示例

本文整理匯總了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);
}
 
開發者ID:maxikg,項目名稱:mongowg,代碼行數:17,代碼來源:ProcessingProtectedRegionCodecTest.java

示例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());
}
 
開發者ID:gvlfm78,項目名稱:BukkitHotels,代碼行數:21,代碼來源:Room.java

示例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;
}
 
開發者ID:jb-aero,項目名稱:SKCompat,代碼行數:58,代碼來源:CHWorldGuard.java


注:本文中的com.sk89q.worldguard.protection.regions.ProtectedRegion.setPriority方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。