当前位置: 首页>>代码示例>>Java>>正文


Java State.DENY属性代码示例

本文整理汇总了Java中com.sk89q.worldguard.protection.flags.StateFlag.State.DENY属性的典型用法代码示例。如果您正苦于以下问题:Java State.DENY属性的具体用法?Java State.DENY怎么用?Java State.DENY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.sk89q.worldguard.protection.flags.StateFlag.State的用法示例。


在下文中一共展示了State.DENY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setBlock

@Override
  public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException
  {
  	Player player = WorldGuardExtraFlagsPlugin.getPlugin().getServer().getPlayer(this.actor.getUniqueId());
if (WorldGuardUtils.hasBypass(player))
  	{
  		return super.setBlock(location, block);
  	}
  	else
  	{
  		if (WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(BukkitUtil.toLocation(player.getWorld(), location)).queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.WORLDEDIT) != State.DENY)
  		{
  			return super.setBlock(location, block);
  		}
  		else
  		{
  			return false;
  		}
  	}
  }
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:20,代码来源:WorldEditFlag.java

示例2: onEntityBlockFormEvent

@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,代码行数:24,代码来源:BlockListener.java

示例3: doUnloadChunkFlagWorldCheck

public static void doUnloadChunkFlagWorldCheck(World world)
{
	for (ProtectedRegion region : WorldGuardExtraFlagsPlugin.worldGuardPlugin.getRegionManager(world).getRegions().values())
	{
		if (region.getFlag(FlagUtils.CHUNK_UNLOAD) == State.DENY)
		{
			WorldGuardExtraFlagsPlugin.getPlugin().getLogger().info("Loading chunks for region " + region.getId() + " located in " + world.getName() + " due to chunk-unload flag being deny");
			
			Location min = BukkitUtil.toLocation(world, region.getMinimumPoint());
			Location max = BukkitUtil.toLocation(world, region.getMaximumPoint());

			for(int x = min.getChunk().getX(); x <= max.getChunk().getX(); x++)
			{
				for(int z = min.getChunk().getZ(); z <= max.getChunk().getZ(); z++)
				{
					world.getChunkAt(x, z).load(true);
				}
			}
		}
	}
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:21,代码来源:WorldGuardExtraFlagsPlugin.java

示例4: sendVanishQuitMessage

public static void sendVanishQuitMessage(Player p) {
	if(!vanishApi.isVanished(p)) {
		if(Bukkit.getPluginManager().isPluginEnabled("WorldGuard")) {
			WorldGuardPlugin wg = (WorldGuardPlugin) Bukkit.getPluginManager().getPlugin("WorldGuard");
			for(ProtectedRegion region : wg.getRegionManager(p.getWorld()).getApplicableRegions(p.getLocation())) {
				if(region.getFlag(DefaultFlag.MOB_SPAWNING) == State.DENY) {
					Bukkit.broadcastMessage(ChatColor.RED + "Whoosh!" + ChatColor.GRAY + " staff member " + ChatColor.GREEN + p.getName() + ChatColor.GRAY + " has left the game safely!");
					vanishApi.vanish(p);
					return;
				}
			}
			Bukkit.broadcastMessage(ChatColor.RED + "Whoosh!" + ChatColor.GRAY + " staff member " + ChatColor.GREEN + p.getName() + ChatColor.GRAY + " has left the game in wild!");
			vanishApi.vanish(p);
		}
	} else {
		p.sendMessage(ChatColor.RED + "you are allready vanished so you can't fake quit, use /vanish fakejoin instead or /vanish");
	}
}
 
开发者ID:xize,项目名称:xEssentials_old_Source,代码行数:18,代码来源:worldguard.java

示例5: sendVanishJoinMessage

public static void sendVanishJoinMessage(Player p) {
	if(vanishApi.isVanished(p)) {
		if(Bukkit.getPluginManager().isPluginEnabled("WorldGuard")) {
			WorldGuardPlugin wg = (WorldGuardPlugin) Bukkit.getPluginManager().getPlugin("WorldGuard");
			for(ProtectedRegion region : wg.getRegionManager(p.getWorld()).getApplicableRegions(p.getLocation())) {
				if(region.getFlag(DefaultFlag.MOB_SPAWNING) == State.DENY) {
					Bukkit.broadcastMessage(ChatColor.GRAY + "a safe staff member " + p.getName() + ChatColor.GRAY + " has been appeared!");
					vanishApi.vanish(p);
					return;
				}
			}
			Bukkit.broadcastMessage(ChatColor.GRAY + "a wild staff member " + ChatColor.GREEN + p.getName() + ChatColor.GRAY + " has been appeared!");
			vanishApi.unvanish(p);
		}
	} else {
		p.sendMessage(ChatColor.RED + "you are allready are unvanished so you can't fake join, use /vanish fakequit instead or /vanish");
	}
}
 
开发者ID:xize,项目名称:xEssentials_old_Source,代码行数:18,代码来源:worldguard.java

示例6: allowSpawn

/**
 * 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,代码行数:20,代码来源:WorldGuardConnection5.java

示例7: allowSpawn

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,代码行数:12,代码来源:WorldGuardConnection6.java

示例8: allowSpawn

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,代码行数:11,代码来源:WorldGuardConnection5.java

示例9: allowSpawn

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,代码行数:13,代码来源:WorldGuardConnection6.java

示例10: onPortalCreateEvent

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPortalCreateEvent(PortalCreateEvent event)
{
	for(Block block : event.getBlocks())
	{
		//Unable to get the player who created it....
		
		ApplicableRegionSet regions = WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(block.getLocation());
		if (regions.queryValue(null, FlagUtils.NETHER_PORTALS) == State.DENY)
		{
			event.setCancelled(true);
			break;
		}
	}
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:15,代码来源:EntityListener.java

示例11: onPlayerInteractEvent

@EventHandler(priority = EventPriority.LOWEST)	
public void onPlayerInteractEvent(PlayerInteractEvent event)
{
	if (WorldGuardExtraFlagsPlugin.isMythicMobsEnabled())
	{
		Player player = event.getPlayer();
		
		if (!WorldGuardUtils.hasBypass(player))
		{
			Action action = event.getAction();
			if (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK)
			{
				if (event.hasItem())
				{
					ItemStack item = event.getItem();
					if (item.getType() == Material.MONSTER_EGG)
					{
						if (item.getItemMeta().hasLore())
						{
							List<String> lore = item.getItemMeta().getLore();
							if (lore.get(0).equals(ChatColor.DARK_GRAY + "" + ChatColor.ITALIC + "A Mythical Egg that can"))
							{
								MythicMob mm = EggManager.getMythicMobFromEgg(lore.get(2));
								if (mm != null)
								{
									ApplicableRegionSet regions = WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(action == Action.RIGHT_CLICK_BLOCK ? event.getClickedBlock().getLocation() : player.getLocation());
									if (regions.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.MYTHICMOB_EGGS) == State.DENY)
									{
										event.setCancelled(true);
										event.setUseItemInHand(Result.DENY);
									}
								}
							}
						}
					}
				}
			}
		}
	}
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:40,代码来源:PlayerListener.java

示例12: onPlayerItemDamageEvent

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerItemDamageEvent(PlayerItemDamageEvent event)
{
	Player player = event.getPlayer();
	
	ApplicableRegionSet regions = WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(player.getLocation());
	if (regions.queryState(WorldGuardUtils.wrapPlayer(player), FlagUtils.ITEM_DURABILITY) == State.DENY) //Not sure should we add bypass for this
	{
		event.setCancelled(true);
	}
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:11,代码来源:PlayerListener.java

示例13: onChunkUnloadEvent

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onChunkUnloadEvent(ChunkUnloadEvent event)
{
	for (ProtectedRegion region : WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionManager(event.getWorld()).getApplicableRegions(new ProtectedCuboidRegion("UnloadChunkFlagTester", new BlockVector(event.getChunk().getX() * 16, 0, event.getChunk().getZ() * 16), new BlockVector(event.getChunk().getX() * 16 + 15, 256, event.getChunk().getZ() * 16 + 15))))
	{
		if (region.getFlag(FlagUtils.CHUNK_UNLOAD) == State.DENY)
		{
			event.setCancelled(true);
			break;
		}
	}
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:12,代码来源:WorldListener.java

示例14: isInRegion

public static boolean isInRegion(Location loc) {
		WorldGuardPlugin wg = (WorldGuardPlugin) Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
		for(ProtectedRegion region : wg.getRegionManager(loc.getWorld()).getApplicableRegions(loc)) {
			if(region.getFlag(DefaultFlag.MOB_SPAWNING) == State.DENY || region.getFlag(DefaultFlag.PVP) == State.DENY) {
				//player has entered
				return true;
			}
		}
		return false;
}
 
开发者ID:xize,项目名称:xEssentials_old_Source,代码行数:10,代码来源:worldguard.java

示例15: isDenied

public boolean isDenied(LocalPlayer localplayer, ProtectedRegion region)
{
    return region.getFlag(FlagUtils.WORLDEDIT) == State.DENY;
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:4,代码来源:FaweWorldEditFlag.java


注:本文中的com.sk89q.worldguard.protection.flags.StateFlag.State.DENY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。