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


Java ProtectedRegion.setFlag方法代碼示例

本文整理匯總了Java中com.sk89q.worldguard.protection.regions.ProtectedRegion.setFlag方法的典型用法代碼示例。如果您正苦於以下問題:Java ProtectedRegion.setFlag方法的具體用法?Java ProtectedRegion.setFlag怎麽用?Java ProtectedRegion.setFlag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.sk89q.worldguard.protection.regions.ProtectedRegion的用法示例。


在下文中一共展示了ProtectedRegion.setFlag方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: importRegion

import com.sk89q.worldguard.protection.regions.ProtectedRegion; //導入方法依賴的package包/類
@Override
protected boolean importRegion(String regionId, String audioId) {
    boolean imported = false;
    for (RegionManager regionManager : regionManagers) {
        // Region IDs are unique for each RegionAudio import, so no need to synchronize
        ProtectedRegion region = regionManager.getRegion(regionId);
        if (region != null) {
            AudioTrack audioTrack = new AudioTrack(audioId);
            Set<AudioTrack> audioTracks = region.getFlag(plugin.getAudioFlag());
            audioTracks = (audioTracks != null ? new HashSet<>(audioTracks) : new HashSet<AudioTrack>());
            if (audioTracks.add(audioTrack)) {
                region.setFlag(plugin.getAudioFlag(), audioTracks);
            }
            imported = true;
        }
    }
    return imported;
}
 
開發者ID:DeadmanDungeons,項目名稱:AudioConnect,代碼行數:19,代碼來源:ImportCommand.java

示例2: 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

示例3: setFlag

import com.sk89q.worldguard.protection.regions.ProtectedRegion; //導入方法依賴的package包/類
public static <T> void setFlag(ProtectedRegion region, Flag<T> flag, String value) throws CommandException, InvalidFlagFormat {
	CommandContext ccontext = new CommandContext("rg "+value, valueFlags);
	region.setFlag(flag, flag.parseInput(WGBukkit.getPlugin(), Bukkit.getConsoleSender(), ccontext.getRemainingString(0)));
	if (ccontext.hasFlag('g')) {
		String group = ccontext.getFlag('g');
		RegionGroupFlag groupFlag = flag.getRegionGroupFlag();
		if (groupFlag == null) {
			return;
		}
		RegionGroup groupValue = groupFlag.parseInput(WGBukkit.getPlugin(), Bukkit.getConsoleSender(), group);
		if (groupValue == groupFlag.getDefault()) {
			region.setFlag(groupFlag, null);
		} else {
			region.setFlag(groupFlag, groupValue);
		}
	}
}
 
開發者ID:Shevchik,項目名稱:WGBuyFlags,代碼行數:18,代碼來源:Utils.java

示例4: allowSpawn

import com.sk89q.worldguard.protection.regions.ProtectedRegion; //導入方法依賴的package包/類
/**
 * Modifies the worldguard regions at the given location to allow spawning for PetBlocks.
 *
 * @param location location
 * @throws NoSuchMethodException     exception
 * @throws IllegalAccessException    exception
 * @throws InvocationTargetException exception
 */
public synchronized static void allowSpawn(Location location) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
    final WorldGuardPlugin worldGuard = getWorldGuard();
    final RegionManager regionManager = worldGuard.getRegionManager(location.getWorld());
    final Iterable<?> set = ReflectionUtils.invokeMethodByObject(regionManager, "getApplicableRegions", new Class[]{location.getClass()}, new Object[]{location});
    for (final Object region1 : set) {
        final ProtectedRegion region = (ProtectedRegion) region1;
        if (region.getFlag(DefaultFlag.MOB_SPAWNING) == State.DENY) {
            region.setFlag(DefaultFlag.MOB_SPAWNING, State.ALLOW);
            flags.add(region);
        }
    }
}
 
開發者ID:Shynixn,項目名稱:PetBlocks,代碼行數:21,代碼來源:WorldGuardConnection5.java

示例5: rollBack

import com.sk89q.worldguard.protection.regions.ProtectedRegion; //導入方法依賴的package包/類
/**
 * Rolls all modified regions back to their original state.
 */
public synchronized static void rollBack() {
    for (final ProtectedRegion region : flags.toArray(new ProtectedRegion[flags.size()])) {
        region.setFlag(DefaultFlag.MOB_SPAWNING, State.DENY);
    }
    flags.clear();
}
 
開發者ID:Shynixn,項目名稱:PetBlocks,代碼行數:10,代碼來源:WorldGuardConnection5.java

示例6: allowSpawn

import com.sk89q.worldguard.protection.regions.ProtectedRegion; //導入方法依賴的package包/類
public synchronized static void allowSpawn(Location location) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException {
    final WorldGuardPlugin worldGuard = getWorldGuard();
    final RegionManager regionManager = worldGuard.getRegionManager(location.getWorld());
    final ApplicableRegionSet set = ReflectionUtils.invokeMethodByObject(regionManager, "getApplicableRegions", new Class[]{location.getClass()}, new Object[]{location});
    final Iterable<ProtectedRegion> regions = (Iterable<ProtectedRegion>) getMethod(set.getClass(), "getRegions").invoke(set);
    for (final ProtectedRegion region : regions) {
        if (region.getFlag(DefaultFlag.MOB_SPAWNING) == State.DENY) {
            region.setFlag(DefaultFlag.MOB_SPAWNING, State.ALLOW);
            flags.add(region);
        }
    }
}
 
開發者ID:Shynixn,項目名稱:PetBlocks,代碼行數:13,代碼來源:WorldGuardConnection6.java

示例7: allowSpawn

import com.sk89q.worldguard.protection.regions.ProtectedRegion; //導入方法依賴的package包/類
public synchronized static void allowSpawn(Location location, Plugin plugin) {
    final WorldGuardPlugin worldGuard = (WorldGuardPlugin) plugin;
    final RegionManager regionManager = worldGuard.getRegionManager(location.getWorld());
    final ApplicableRegionSet set = regionManager.getApplicableRegions(location);
    for (final ProtectedRegion region : set) {
        if (region.getFlag(DefaultFlag.MOB_SPAWNING) == State.DENY) {
            region.setFlag(DefaultFlag.MOB_SPAWNING, State.ALLOW);
            flags.add(region);
        }
    }
}
 
開發者ID:Shynixn,項目名稱:BlockBall,代碼行數:12,代碼來源:WorldGuardConnection5.java

示例8: allowSpawn

import com.sk89q.worldguard.protection.regions.ProtectedRegion; //導入方法依賴的package包/類
public synchronized static void allowSpawn(Location location, Plugin plugin) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
    final WorldGuardPlugin worldGuard = (WorldGuardPlugin) plugin;
    final RegionManager regionManager = worldGuard.getRegionManager(location.getWorld());
    final ApplicableRegionSet set = regionManager.getApplicableRegions(location);
    @SuppressWarnings("unchecked") final
    Iterable<ProtectedRegion> regions = (Iterable<ProtectedRegion>) getMethod(set.getClass()).invoke(set);
    for (final ProtectedRegion region : regions) {
        if (region.getFlag(DefaultFlag.MOB_SPAWNING) == State.DENY) {
            region.setFlag(DefaultFlag.MOB_SPAWNING, State.ALLOW);
            flags.add(region);
        }
    }
}
 
開發者ID:Shynixn,項目名稱:BlockBall,代碼行數:14,代碼來源:WorldGuardConnection6.java

示例9: saveRegionSetFlag

import com.sk89q.worldguard.protection.regions.ProtectedRegion; //導入方法依賴的package包/類
private <T> boolean saveRegionSetFlag(RegionManager regionManager, ProtectedRegion region, SetFlag<T> flag, Set<T> value) {
    try {
        region.setFlag(flag, value);
        regionManager.saveChanges();
        return true;
    } catch (StorageException e) {
        String msg = "Failed to save '" + regionManager + "' WorldGuard region changes from edit command";
        plugin.getLogger().log(Level.WARNING, msg, e);
        return false;
    }
}
 
開發者ID:DeadmanDungeons,項目名稱:AudioConnect,代碼行數:12,代碼來源:RegionCommand.java

示例10: updateLockStatus

import com.sk89q.worldguard.protection.regions.ProtectedRegion; //導入方法依賴的package包/類
private static void updateLockStatus(ProtectedRegion region, boolean isLocked) {
    if (isLocked) {
        region.setFlag(DefaultFlag.ENTRY, StateFlag.State.DENY);
    } else {
        region.setFlag(DefaultFlag.ENTRY, null);
    }
}
 
開發者ID:rlf,項目名稱:uSkyBlock,代碼行數:8,代碼來源:WorldGuardHandler.java

示例11: makeRoomAccessible

import com.sk89q.worldguard.protection.regions.ProtectedRegion; //導入方法依賴的package包/類
public static void makeRoomAccessible(ProtectedRegion region){
	if(HTConfigHandler.getconfigYML().getBoolean("allowPlayersIntoFreeRooms", true)){
		region.setFlag(DefaultFlag.INTERACT, null);
		region.setFlag(DefaultFlag.USE, null);
		makeRoomContainersAccessible(region);
	}
}
 
開發者ID:gvlfm78,項目名稱:BukkitHotels,代碼行數:8,代碼來源:HTWorldGuardManager.java

示例12: rename

import com.sk89q.worldguard.protection.regions.ProtectedRegion; //導入方法依賴的package包/類
public void rename(String newName) throws EventCancelledException, HotelNonExistentException {
	HotelRenameEvent hre = new HotelRenameEvent(this, newName);
	Bukkit.getPluginManager().callEvent(hre);
	newName = hre.getNewName(); //In case it was modified by the event

	if(hre.isCancelled()) throw new EventCancelledException();
	if(!exists()) throw new HotelNonExistentException();

	//Change hotel name inside reception sign files
	ArrayList<ReceptionSign> rss = getAllReceptionSigns();
	for(ReceptionSign rs : rss)
		rs.setHotelNameInConfig(newName);

	//Renaming reception signs folder to new name
	HTConfigHandler.getReceptionSignsFolder(name).renameTo(HTConfigHandler.getReceptionSignsFolder(newName));

	//Rename rooms
	ArrayList<Room> rooms = getRooms();

	for(Room room : rooms){
		room.renameRoom(newName);
		File hotelsFile = getHotelFile();
		File newHotelsfile = HTConfigHandler.getHotelFile(newName);
		hotelsFile.renameTo(newHotelsfile);
	}
	HTWorldGuardManager.renameRegion("hotel-" + name, "hotel-" + newName, world);
	name = newName;
	ProtectedRegion r = getRegion();

	if(Mes.flagValue("hotel.map-making.GREETING").equalsIgnoreCase("true"))
		r.setFlag(DefaultFlag.GREET_MESSAGE, (Mes.getStringNoPrefix("message.hotel.enter").replaceAll("%hotel%", name)));
	if(Mes.flagValue("hotel.map-making.FAREWELL") != null)
		r.setFlag(DefaultFlag.FAREWELL_MESSAGE, (Mes.getStringNoPrefix("message.hotel.exit").replaceAll("%hotel%", name)));

	updateReceptionSigns();
}
 
開發者ID:gvlfm78,項目名稱:BukkitHotels,代碼行數:37,代碼來源:Hotel.java

示例13: setFlag

import com.sk89q.worldguard.protection.regions.ProtectedRegion; //導入方法依賴的package包/類
/**
 * Set a WorldGuard region flag.
 * @param region The WorldGuard region to set
 * @param flag   The flag to set
 * @param value  The value to set the flag to
 * @param <V>    They type of flag to set
 * @throws InvalidFlagFormat When the value of the flag is wrong
 */
private <V> void setFlag(ProtectedRegion region, Flag<V> flag, String value) throws InvalidFlagFormat {
	V current = region.getFlag(flag);
	V next = plugin.getWorldGuardHandler().parseFlagInput(flag, value);

	if(!Objects.equals(current, next)) {
		region.setFlag(flag, next);
	}
}
 
開發者ID:NLthijs48,項目名稱:AreaShop,代碼行數:17,代碼來源:WorldGuardRegionFlagsFeature.java

示例14: resetRegionFlags

import com.sk89q.worldguard.protection.regions.ProtectedRegion; //導入方法依賴的package包/類
/**
 * Reset all flags of the region.
 */
public void resetRegionFlags() {
	ProtectedRegion region = getRegion();
	if(region != null) {
		region.setFlag(DefaultFlag.GREET_MESSAGE, null);
		region.setFlag(DefaultFlag.FAREWELL_MESSAGE, null);
	}
}
 
開發者ID:NLthijs48,項目名稱:AreaShop,代碼行數:11,代碼來源:GeneralRegion.java

示例15: setFlag

import com.sk89q.worldguard.protection.regions.ProtectedRegion; //導入方法依賴的package包/類
private <V> void setFlag(Target t, ProtectedRegion region,
						 Flag<V> flag, CommandSender sender, String value)
		throws InvalidFlagFormat {
	try {
		region.setFlag(flag, flag.parseInput(FlagContext.create().setSender(sender).setInput(value).build()));
	} catch (NoClassDefFoundError ex) {
		// probably WorldGuard 3.1.2 or earlier
		region.setFlag(flag, flag.unmarshal(ReflectionUtils.invokeMethod(flag, "parseInput", WorldGuardPlugin.inst(), sender, value)));
	}
}
 
開發者ID:jb-aero,項目名稱:SKCompat,代碼行數:11,代碼來源:CHWorldGuard.java


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