当前位置: 首页>>代码示例>>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;未经允许,请勿转载。