本文整理匯總了Java中com.sk89q.worldguard.protection.ApplicableRegionSet.queryValue方法的典型用法代碼示例。如果您正苦於以下問題:Java ApplicableRegionSet.queryValue方法的具體用法?Java ApplicableRegionSet.queryValue怎麽用?Java ApplicableRegionSet.queryValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sk89q.worldguard.protection.ApplicableRegionSet
的用法示例。
在下文中一共展示了ApplicableRegionSet.queryValue方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}
示例2: 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);
}
}
}
}
示例3: 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);
}
}
示例4: 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);
}
}
示例5: 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);
}
}
}
}
}
}
示例6: onPortalCreateEvent
import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入方法依賴的package包/類
@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;
}
}
}
示例7: onPlayerRespawnEvent
import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerRespawnEvent(PlayerRespawnEvent event)
{
Player player = event.getPlayer();
ApplicableRegionSet regions = WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(player.getLocation());
Location respawnLocation = regions.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.RESPAWN_LOCATION); //Not sure should we add bypass for this
if (respawnLocation != null)
{
event.setRespawnLocation(BukkitUtil.toLocation(respawnLocation));
}
}
示例8: onPlayerInteractEvent
import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入方法依賴的package包/類
@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);
}
}
}
}
}
}
}
}
}
}
示例9: onPlayerSpawnLocationEvent
import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerSpawnLocationEvent(PlayerSpawnLocationEvent event)
{
Player player = event.getPlayer();
ApplicableRegionSet regions = WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(player.getLocation());
Location location = regions.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.JOIN_LOCATION); //Not sure should we add bypass for this
if (location != null)
{
event.setSpawnLocation(BukkitUtil.toLocation(location));
}
}
示例10: onBlockPlaceEvent
import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = false)
public void onBlockPlaceEvent(PlaceBlockEvent event)
{
Result originalResult = event.getResult();
Object cause = event.getCause().getRootCause();
if (cause instanceof Player)
{
Player player = (Player)cause;
if (!WorldGuardUtils.hasBypass(player))
{
for(Block block : event.getBlocks())
{
ApplicableRegionSet regions = WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(block.getLocation());
Set<Material> state = regions.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.ALLOW_BLOCK_PLACE);
if (state != null && state.contains(block.getType()))
{
event.setResult(Result.ALLOW);
}
else
{
Set<Material> state2 = regions.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.DENY_BLOCK_PLACE);
if (state2 != null && state2.contains(block.getType()))
{
event.setResult(Result.DENY);
return;
}
else
{
event.setResult(originalResult);
return;
}
}
}
}
}
}
示例11: onBlockBreakEvent
import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = false)
public void onBlockBreakEvent(BreakBlockEvent event)
{
Result originalResult = event.getResult();
Object cause = event.getCause().getRootCause();
if (cause instanceof Player)
{
Player player = (Player)cause;
if (!WorldGuardUtils.hasBypass(player))
{
for(Block block : event.getBlocks())
{
ApplicableRegionSet regions = WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(block.getLocation());
Set<Material> state = regions.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.ALLOW_BLOCK_BREAK);
if (state != null && state.contains(block.getType()))
{
event.setResult(Result.ALLOW);
}
else
{
Set<Material> state2 = regions.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.DENY_BLOCK_BREAK);
if (state2 != null && state2.contains(block.getType()))
{
event.setResult(Result.DENY);
return;
}
else
{
event.setResult(originalResult);
return;
}
}
}
}
}
}
示例12: inTaggedRegion
import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入方法依賴的package包/類
public boolean inTaggedRegion(RegionAssociable source, ApplicableRegionSet checkSet, Set<String> tags) {
Set<String> regionTags = checkSet.queryValue(source, SPAWN_TAGS);
if (regionTags == null) {
return false;
}
return regionTags.contains("*") || !Collections.disjoint(regionTags, tags);
}
示例13: check
import com.sk89q.worldguard.protection.ApplicableRegionSet; //導入方法依賴的package包/類
private void check(Player player, ApplicableRegionSet set)
{
Set<PotionEffectType> potionEffects = set.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.BLOCKED_EFFECTS);
if (potionEffects != null && potionEffects.size() > 0)
{
for (PotionEffectType effectType : potionEffects)
{
PotionEffect effect = null;
for(PotionEffect activeEffect : player.getActivePotionEffects())
{
if (activeEffect.getType().equals(effectType))
{
effect = activeEffect;
break;
}
}
if (effect != null)
{
if (WorldGuardExtraFlagsPlugin.isSupportsMobEffectColors())
{
this.removedEffects.put(effect.getType(), new PotionEffectDetails(TimeUtils.getUnixtimestamp() + effect.getDuration() / 20, effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.getColor()));
}
else
{
this.removedEffects.put(effect.getType(), new PotionEffectDetails(TimeUtils.getUnixtimestamp() + effect.getDuration() / 20, effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), null));
}
player.removePotionEffect(effectType);
}
}
}
Iterator<Entry<PotionEffectType, PotionEffectDetails>> potionEffects_ = this.removedEffects.entrySet().iterator();
while (potionEffects_.hasNext())
{
Entry<PotionEffectType, PotionEffectDetails> potionEffect = potionEffects_.next();
if (potionEffects == null || !potionEffects.contains(potionEffect.getKey()))
{
PotionEffectDetails removedEffect = potionEffect.getValue();
if (removedEffect != null)
{
int timeLeft = removedEffect.getTimeLeftInTicks();
if (timeLeft > 0)
{
if (WorldGuardExtraFlagsPlugin.isSupportsMobEffectColors())
{
player.addPotionEffect(new PotionEffect(potionEffect.getKey(), timeLeft, removedEffect.getAmplifier(), removedEffect.isAmbient(), removedEffect.isParticles(), removedEffect.getColor()), true);
}
else
{
player.addPotionEffect(new PotionEffect(potionEffect.getKey(), timeLeft, removedEffect.getAmplifier(), removedEffect.isAmbient(), removedEffect.isParticles()), true);
}
}
}
potionEffects_.remove();
}
}
}