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


Java ApplicableRegionSet類代碼示例

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


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

示例1: isPVPEnabled

import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入依賴的package包/類
public static boolean isPVPEnabled(Location location) {
	String global = "__global__";
	if(plugin.getWorldGuard().getRegionManager(location.getWorld()) == null)	
		return true;
	RegionManager regionManager = plugin.getWorldGuard().getRegionManager(location.getWorld());
	ApplicableRegionSet arset = regionManager.getApplicableRegions(location);
	ProtectedRegion region = regionManager.getRegion(global);
	int priority = -10000;
	for(ProtectedRegion r : arset.getRegions()) { 
		if(r.getPriority() > priority) {
			region = r;
			priority = r.getPriority();
		}
	}
	if(region == null) {
		if(regionManager.getRegion(global) == null)
			return false;
		return "ALLOW".equals(regionManager.getRegion(global).getFlag(DefaultFlag.PVP).toString());
	}
	if(region.getFlag(DefaultFlag.PVP) == null)
		return true;
	return "ALLOW".equalsIgnoreCase(region.getFlag(DefaultFlag.PVP).toString());
}
 
開發者ID:benNek,項目名稱:AsgardAscension,代碼行數:24,代碼來源:Utility.java

示例2: queryRegions

import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入依賴的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

示例3: getRegion

import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入依賴的package包/類
public ProtectedRegion getRegion(final Player player, final Location loc)
{
    final com.sk89q.worldguard.LocalPlayer localplayer = WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().wrapPlayer(player);
    RegionManager manager = WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionManager(player.getWorld());
    final ProtectedRegion global = manager.getRegion("__global__");
    if (global != null && !isDenied(localplayer, global))
    {
        return global;
    }
    
    final ApplicableRegionSet regions = manager.getApplicableRegions(player.getLocation());
    for (final ProtectedRegion region : regions)
    {
        if (!isDenied(localplayer, region))
        {
            return region;
        }
    }
    return null;
}
 
開發者ID:isokissa3,項目名稱:WorldGuardExtraFlagsPlugin,代碼行數:21,代碼來源:FaweWorldEditFlag.java

示例4: onCrossBoundary

import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入依賴的package包/類
@SuppressWarnings("deprecation")
@Override
public boolean onCrossBoundary(Player player, Location from, Location to, ApplicableRegionSet toSet, Set<ProtectedRegion> entered, Set<ProtectedRegion> exited, MoveType moveType)
{
	if (!WorldGuardUtils.hasBypass(player))
	{
		if (!player.hasMetadata("WGEFP-TPOEF"))
		{
			com.sk89q.worldedit.Location location = toSet.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.TELEPORT_ON_ENTRY);
			if (location != null)
			{
				player.setMetadata("WGEFP-TPOEF", new FixedMetadataValue(WorldGuardExtraFlagsPlugin.getPlugin(), null));
				player.teleport(BukkitUtil.toLocation(location));
			}
		}
	}
	
	return true;
}
 
開發者ID:isokissa3,項目名稱:WorldGuardExtraFlagsPlugin,代碼行數:20,代碼來源:TeleportOnEntryFlag.java

示例5: onCrossBoundary

import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入依賴的package包/類
@SuppressWarnings("deprecation")
@Override
public boolean onCrossBoundary(Player player, Location from, Location to, ApplicableRegionSet toSet, Set<ProtectedRegion> entered, Set<ProtectedRegion> exited, MoveType moveType)
{
	if (!WorldGuardUtils.hasBypass(player))
	{
		if (!player.hasMetadata("WGEFP-TPOEF"))
		{
			for (ProtectedRegion exitd : exited)
			{
				com.sk89q.worldedit.Location location = exitd.getFlag(FlagUtils.TELEPORT_ON_EXIT);
				if (location != null)
				{
					player.setMetadata("WGEFP-TPOEF", new FixedMetadataValue(WorldGuardExtraFlagsPlugin.getPlugin(), null));
					player.teleport(BukkitUtil.toLocation(location));
					
					break;
				}
			}
		}
	}
	
	return true;
}
 
開發者ID:isokissa3,項目名稱:WorldGuardExtraFlagsPlugin,代碼行數:25,代碼來源:TeleportOnExitFlag.java

示例6: onEntityToggleGlideEvent

import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityToggleGlideEvent(EntityToggleGlideEvent event)
{
	if (event.getEntity() instanceof Player)
	{
		Player player = (Player)event.getEntity();
		if (!WorldGuardUtils.hasBypass(player))
		{
			ApplicableRegionSet regions = WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(player.getLocation());

			State state = regions.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.GLIDE);
			if (state != null)
			{
				event.setCancelled(true);
				player.setGliding(state == State.ALLOW);
			}
		}
	}
}
 
開發者ID:isokissa3,項目名稱:WorldGuardExtraFlagsPlugin,代碼行數:20,代碼來源:EntityListenerOnePointNine.java

示例7: onPlayerDeathEvent

import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerDeathEvent(PlayerDeathEvent event)
{
	Player player = event.getEntity();
	
	ApplicableRegionSet regions = WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(player.getLocation());
	
	Boolean keepInventory = regions.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.KEEP_INVENTORY); //Not sure should we add bypass for this
	if (keepInventory != null && keepInventory)
	{
		event.setKeepInventory(true);
		event.getDrops().clear();
	}
	
	Boolean keepExp = regions.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.KEEP_EXP); //Not sure should we add bypass for this
	if (keepExp != null && keepExp)
	{
		event.setKeepLevel(true);
		event.setDroppedExp(0);
	}
}
 
開發者ID:isokissa3,項目名稱:WorldGuardExtraFlagsPlugin,代碼行數:22,代碼來源:PlayerListener.java

示例8: onAsyncPlayerChatEvent

import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onAsyncPlayerChatEvent(AsyncPlayerChatEvent event)
{
	Player player = event.getPlayer();
	
	ApplicableRegionSet regions = WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(player.getLocation());
	
	String prefix = regions.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.CHAT_PREFIX); //Not sure should we add bypass for this
	String suffix = regions.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.CHAT_SUFFIX); //Not sure should we add bypass for this
	
	if (prefix != null)
	{
		event.setFormat(prefix + event.getFormat());
	}
	
	if (suffix != null)
	{
		event.setFormat(event.getFormat() + suffix);
	}
}
 
開發者ID:isokissa3,項目名稱:WorldGuardExtraFlagsPlugin,代碼行數:21,代碼來源:PlayerListener.java

示例9: onEntityBlockFormEvent

import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityBlockFormEvent(EntityBlockFormEvent event)
{
	if (WorldGuardExtraFlagsPlugin.isSupportFrostwalker())
	{
		BlockState newState = event.getNewState();
		if (newState.getType() == Material.FROSTED_ICE)
		{
			if (event.getEntity() instanceof Player)
			{
				Player player = (Player)event.getEntity();

				if (!WorldGuardUtils.hasBypass(player))
				{
					ApplicableRegionSet regions = WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(newState.getLocation());
					if (regions.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.FROSTWALKER) == State.DENY)
					{
						event.setCancelled(true);
					}
				}
			}
		}
	}
}
 
開發者ID:isokissa3,項目名稱:WorldGuardExtraFlagsPlugin,代碼行數:25,代碼來源:BlockListener.java

示例10: isInIgnoredRegion

import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入依賴的package包/類
/**
 * Check whether a block is in a region we don't check for protection in
 * @param block The block to check
 * @return true if the region exists and has protection disabled, false otherwise
 */
public boolean isInIgnoredRegion(Block block) {
    if (this.plugin instanceof BukkitPlugin) {
        Vector point = toVector((org.bukkit.block.Block) block.getWrapped());
        RegionManager regionManager = ((BukkitPlugin) this.plugin).getWorldGuard().getRegionManager((World) block.getWorld().getWrapped());
        ApplicableRegionSet set = regionManager.getApplicableRegions(point);

        Boolean result = set.getFlag(BukkitPlugin.bypassProtectionFlag);

        if (result == null) {
            return false;
        }

        return result;
    }

    return false;
}
 
開發者ID:TheArchives,項目名稱:ArchBlock,代碼行數:23,代碼來源:WorldGuard.java

示例11: getRegion

import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入依賴的package包/類
public ProtectedRegion getRegion(final com.sk89q.worldguard.LocalPlayer player, final Location loc) {
    RegionManager manager = this.worldguard.getRegionManager(loc.getWorld());
    if (manager == null) {
        if (this.worldguard.getGlobalStateManager().get(loc.getWorld()).useRegions) {
            System.out.println("Region capability is not enabled for WorldGuard.");
        } else {
            System.out.println("WorldGuard is not enabled for that world.");
        }
        return null;
    }
    final ProtectedRegion global = manager.getRegion("__global__");
    if (global != null && isAllowed(player, global)) {
        return global;
    }
    final ApplicableRegionSet regions = manager.getApplicableRegions(loc);
    for (final ProtectedRegion region : regions) {
        if (isAllowed(player, region)) {
            return region;
        }
    }
    return null;
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:23,代碼來源:Worldguard.java

示例12: isForbiddenSkillInRegion

import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入依賴的package包/類
public boolean isForbiddenSkillInRegion(Player player, SkillType skill) {
    if (worldGuard != null) {
        Location location = player.getLocation();
        RegionManager regionManager = worldGuard.getRegionContainer().get(player.getWorld());
        if (regionManager == null) {
            return false;
        }

        ApplicableRegionSet regions = regionManager.getApplicableRegions(location);

        LocalPlayer localPlayer = worldGuard.wrapPlayer(player);
        return regions.queryAllValues(localPlayer, skillListFlag).contains(skill);
    }

    return false;
}
 
開發者ID:games647,項目名稱:mcMMOExtras,代碼行數:17,代碼來源:WorldGuardFlagSupport.java

示例13: getPrioritizedRegion

import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入依賴的package包/類
/**
 * Método que obtém a região com maior prioridade em um certo local
 *
 * @param around Local onde existe as regiões
 * @return Retorna a região com maior prioridade
 */
public static ProtectedRegion getPrioritizedRegion ( final Location around )
{
	final WorldGuardPlugin plugin = ( WorldGuardPlugin ) Framework.worldguard;
	final ApplicableRegionSet set = plugin.getRegionManager( around.getWorld() ).getApplicableRegions( around );
	ProtectedRegion prime = null;
	for ( final ProtectedRegion region : set )
	{
		if ( ( prime != null ) && ( region.getPriority() > prime.getPriority() ) )
		{
			prime = region;
		}
		else
		{
			prime = region;
		}
	}

	return prime;
}
 
開發者ID:ProjectSandstone,項目名稱:EventoZero,代碼行數:26,代碼來源:Framework.java

示例14: getRoomAtLocation

import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入依賴的package包/類
public static Room getRoomAtLocation(Location loc, String hotelName){
	World w = loc.getWorld();
	//Get all regions that contain this location point
	ApplicableRegionSet regions = HTWorldGuardManager.getRM(w).getApplicableRegions(loc);

	for(ProtectedRegion r : regions){
		String ID = r.getId();
		if(!ID.startsWith("hotel-" + hotelName)) continue;

		String roomNum = ID.replaceFirst("\\w+-\\w*-", "");

		try{
			Integer.parseInt(roomNum);
		}
		catch(NumberFormatException e){
			continue;
		}

		Room room = new Room(w, hotelName, roomNum);

		if(room.exists())
			return room;
	}
	return null;
}
 
開發者ID:gvlfm78,項目名稱:BukkitHotels,代碼行數:26,代碼來源:HotelsAPI.java

示例15: SprawdzCzyWterenie

import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入依賴的package包/類
public static boolean  SprawdzCzyWterenie(Location loc,String nazwaAreny)
 {
  WorldGuardPlugin wg = getWorldGuard();
  Vector pt = toVector(loc); // This also takes a location
  RegionManager regionManager = wg.getRegionManager(loc.getWorld());
  ApplicableRegionSet set = regionManager.getApplicableRegions(pt);
  for (ProtectedRegion region : set) {
		   if(region.getId().equalsIgnoreCase(nazwaAreny)){
			  // System.out.println("Jestes w tym regionie"); 
			   //p.sendMessage("Jestes w tym regionie");
			   return true;
		   }
	}
 
return false;

 }
 
開發者ID:grzegorz2047,項目名稱:AceOfSpadesMiniGame,代碼行數:18,代碼來源:CheckArea.java


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