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


Java State类代码示例

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


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

示例1: updateGlide

import com.sk89q.worldguard.protection.flags.StateFlag.State; //导入依赖的package包/类
private void updateGlide(Player player, State newValue, World world)
{
	if (!WorldGuardUtils.hasBypass(player) && newValue != null)
	{
		boolean value = (newValue == State.ALLOW ? true : false);
		
		if (player.isGliding() != value)
		{
			if (this.originalGlide == null)
			{
				this.originalGlide = player.isGliding();
			}
			
			player.setGliding(value);
		}
	}
	else
	{
		if (this.originalGlide != null)
		{
			player.setGliding(this.originalGlide);
			
			this.originalGlide = null;
		}
	}
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:27,代码来源:GlideFlag.java

示例2: updateFly

import com.sk89q.worldguard.protection.flags.StateFlag.State; //导入依赖的package包/类
private void updateFly(Player player, State newValue, World world)
{
	if (!WorldGuardUtils.hasBypass(player) && newValue != null)
	{
		boolean value = (newValue == State.ALLOW ? true : false);
		
		if (player.getAllowFlight() != value)
		{
			if (this.originalFly == null)
			{
				this.originalFly = player.getAllowFlight();
			}
			
			player.setAllowFlight(value);
		}
	}
	else
	{
		if (this.originalFly != null)
		{
			player.setAllowFlight(this.originalFly);
			
			this.originalFly = null;
		}
	}
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:27,代码来源:FlyFlag.java

示例3: setBlock

import com.sk89q.worldguard.protection.flags.StateFlag.State; //导入依赖的package包/类
@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,代码行数:21,代码来源:WorldEditFlag.java

示例4: onEntityToggleGlideEvent

import com.sk89q.worldguard.protection.flags.StateFlag.State; //导入依赖的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

示例5: onEntityBlockFormEvent

import com.sk89q.worldguard.protection.flags.StateFlag.State; //导入依赖的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

示例6: doUnloadChunkFlagWorldCheck

import com.sk89q.worldguard.protection.flags.StateFlag.State; //导入依赖的package包/类
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,代码行数:22,代码来源:WorldGuardExtraFlagsPlugin.java

示例7: sendVanishQuitMessage

import com.sk89q.worldguard.protection.flags.StateFlag.State; //导入依赖的package包/类
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,代码行数:19,代码来源:worldguard.java

示例8: sendVanishJoinMessage

import com.sk89q.worldguard.protection.flags.StateFlag.State; //导入依赖的package包/类
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,代码行数:19,代码来源:worldguard.java

示例9: allowSpawn

import com.sk89q.worldguard.protection.flags.StateFlag.State; //导入依赖的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

示例10: rollBack

import com.sk89q.worldguard.protection.flags.StateFlag.State; //导入依赖的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

示例11: allowSpawn

import com.sk89q.worldguard.protection.flags.StateFlag.State; //导入依赖的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

示例12: allowSpawn

import com.sk89q.worldguard.protection.flags.StateFlag.State; //导入依赖的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

示例13: allowSpawn

import com.sk89q.worldguard.protection.flags.StateFlag.State; //导入依赖的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

示例14: onSetValue

import com.sk89q.worldguard.protection.flags.StateFlag.State; //导入依赖的package包/类
@Override
protected boolean onSetValue(Player player, Location from, Location to, ApplicableRegionSet toSet, State currentValue, State lastValue, MoveType moveType)
{
   	this.updateGlide(player, currentValue, to.getWorld());
   	
	return true;
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:8,代码来源:GlideFlag.java

示例15: onAbsentValue

import com.sk89q.worldguard.protection.flags.StateFlag.State; //导入依赖的package包/类
@Override
protected boolean onAbsentValue(Player player, Location from, Location to, ApplicableRegionSet toSet, State lastValue, MoveType moveType)
{
   	this.updateGlide(player, null, player.getWorld());
   	
	return true;
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:8,代码来源:GlideFlag.java


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