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


Java EventPriority.HIGH属性代码示例

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


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

示例1: equipWeaponEvent

@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void equipWeaponEvent(InventoryDragEvent event) {
	if (!enabled) return;
	HumanEntity human = event.getWhoClicked();
	boolean alreadyHasGun = hasGun(human);
	
	Inventory inv = event.getInventory();
	ItemStack prior = event.getOldCursor();
	
	// Don't really care what sort of drag, if we have a gun in inv and this was a gun, deny.
	if (alreadyHasGun && (inv != null && !InventoryType.PLAYER.equals(inv.getType()))
			&& (prior != null && isGun(prior))) {
		event.setResult(Result.DENY);
		// yes this will prevent drag style of weapon in chest invs. Oh well.
	}
	
}
 
开发者ID:ProgrammerDan,项目名称:AddGun,代码行数:17,代码来源:RailGun.java

示例2: onPlayerDamage

@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onPlayerDamage(EntityDamageEvent event) {
    if (event.getCause() == EntityDamageEvent.DamageCause.VOID) {
        Entity entity = event.getEntity();
        if (entity instanceof Player) {
            // Allow players to die by VOID in the END
            if (entity.getWorld().getEnvironment() == World.Environment.THE_END) {
                return;
            }

            Location destination = BukkitUtils.getHighestLocation(entity.getLocation());
            if (destination == null)
                return;

            if (entity.teleport(destination, PlayerTeleportEvent.TeleportCause.PLUGIN)) {
                event.setCancelled(true);
                ((Player) entity).sendMessage(ChatColor.YELLOW + "You were saved from the void.");
            }
        }
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:21,代码来源:VoidGlitchFixListener.java

示例3: onArcherSpeedClick

@EventHandler(ignoreCancelled=false, priority=EventPriority.HIGH)
public void onArcherSpeedClick(PlayerInteractEvent event)
{
    Action action = event.getAction();
    if (((action == Action.RIGHT_CLICK_AIR) || (action == Action.RIGHT_CLICK_BLOCK)) &&
            (event.hasItem()) && (event.getItem().getType() == Material.SUGAR))
    {
        if (this.plugin.getPvpClassManager().getEquippedClass(event.getPlayer()) != this) {
            return;
        }
        Player player = event.getPlayer();
        UUID uuid = player.getUniqueId();
        long timestamp = this.archerSpeedCooldowns.get(uuid);
        long millis = System.currentTimeMillis();
        long remaining = timestamp == this.archerSpeedCooldowns.getNoEntryValue() ? -1L : timestamp - millis;
        if (remaining > 0L)
        {
            player.sendMessage(ChatColor.RED + "Cannot use Speed Boost for another " + DurationFormatUtils.formatDurationWords(remaining, true, true) + ".");
        }
        else
        {
            ItemStack stack = player.getItemInHand();
            if (stack.getAmount() == 1) {
                player.setItemInHand(new ItemStack(Material.AIR, 1));
            } else {
                stack.setAmount(stack.getAmount() - 1);
            }
            player.sendMessage(ChatColor.GREEN + "Speed 4 activated for 7 seconds.");

            this.plugin.getEffectRestorer().setRestoreEffect(player, ARCHER_SPEED_EFFECT);
            this.archerSpeedCooldowns.put(event.getPlayer().getUniqueId(), System.currentTimeMillis() + ARCHER_SPEED_COOLDOWN_DELAY);
        }
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:34,代码来源:ArcherClass.java

示例4: onBlockPlace

@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onBlockPlace(BlockPlaceEvent event) {
    Key key = plugin.getKeyManager().getKey(event.getItemInHand());
    if (key != null) {
        event.setCancelled(true);
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:7,代码来源:KeyListener.java

示例5: onBlockBreak

@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onBlockBreak(final BlockBreakEvent event) {
    if (!isWithinBorder(event.getBlock().getLocation())) {
        event.setCancelled(true);
        event.getPlayer().sendMessage(ChatColor.RED + "You cannot break blocks past the border.");
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:7,代码来源:BorderListener.java

示例6: onPlayerTeleport

/**
 * Prevent teleporting outside the map
 */
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerTeleport(final PlayerTeleportEvent event) {
    if(event.getCause() == PlayerTeleportEvent.TeleportCause.PLUGIN) {
        double fromY = event.getFrom().getY();
        double toY = event.getTo().getY();

        if((fromY >= 0.0D && fromY < 255.0D) && (toY < 0.0D || toY >= 255.0D)) {
            event.setCancelled(true);
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:14,代码来源:InternalMatchModule.java

示例7: onCommand

@EventHandler(priority = EventPriority.HIGH)
public void onCommand(PlayerCommandPreprocessEvent e){
    Player p = e.getPlayer();
    if(manager.isInPvP(p)){
        e.setCancelled(true);
        p.sendMessage(Utils.colorize(PAData.SURVIVAL.getPrefix() + ChatColor.DARK_RED + " ¡No puedes ejecutar comandos en pvp!"));
    }
}
 
开发者ID:cadox8,项目名称:PA,代码行数:8,代码来源:PlayerEvents.java

示例8: onChannelMessage

@EventHandler (priority = EventPriority.HIGH)
public void onChannelMessage(ChannelMessageEvent event) {
	ChatChannel channel = event.getChannel();
	KingdomFactionsPlayer player = event.getByWho();
	
	int cooldownSeconds = channel.getRank(player).getCooldown();
	if (cooldownSeconds != 0  && !player.hasPermission(ChatModule.CHAT_ALWAYS_PERMISSION)) {
			return;
	}
}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:10,代码来源:ChannelMessageEventListener.java

示例9: toggleSneakEvent

/**
 * Keeps track of player sneaking; if they are sneaking, we track when the
 * snuck, or, clear if unsnuck.
 * 
 * @param event
 *            the sneak toggle event
 */
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void toggleSneakEvent(PlayerToggleSneakEvent event) {
	if (event.isSneaking()) {
		sneakingSince.computeIfAbsent(event.getPlayer().getUniqueId(), u -> {
			if (event.getPlayer().hasPermission("addgun.data")) { event.getPlayer().sendMessage(ChatColor.GOLD + " sneak started"); }
			return System.currentTimeMillis();
		});
	} else {
		if (sneakingSince.containsKey(event.getPlayer().getUniqueId()) && event.getPlayer().hasPermission("addgun.data")) { 
			event.getPlayer().sendMessage(ChatColor.GOLD + " sneak cleared");
		}
		sneakingSince.remove(event.getPlayer().getUniqueId());
	}
}
 
开发者ID:ProgrammerDan,项目名称:AddGun,代码行数:21,代码来源:RailGun.java

示例10: onMatchCycle

@EventHandler(priority = EventPriority.HIGH)
public void onMatchCycle(CycleEvent event) {
    tourney.setState(TourneyState.ENABLED_WAITING_FOR_TEAMS);
    teamManager.assignTeams(vote.getParticipatingTeams());

    clearCurrentVote();
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:7,代码来源:VoteContext.java

示例11: onEntityDamage

@EventHandler(priority = EventPriority.HIGH)
public void onEntityDamage(EntityDamageEvent event)
{
	
	//cancel if on periscope
	if( event.getEntity() instanceof Player )
	{
		Player player = (Player)event.getEntity();


		for( Periscope p: NavyCraft.allPeriscopes )
		{
			if( p.user == player )
			{
				event.setCancelled(true);
    			return;
			}
		}
		
		if( event.getCause() == DamageCause.SUFFOCATION )
		{
			Craft c = Craft.getCraft(player.getLocation().getBlockX(),player.getLocation().getBlockY(), player.getLocation().getBlockZ());
			if( c != null )
			{
				event.setCancelled(true);
    			return;
			}
				
		}
		
	}
	
	if ( event instanceof EntityDamageByEntityEvent ) 
	{


		Entity attacker = ((EntityDamageByEntityEvent) event).getDamager();
		if( attacker instanceof Egg )
		{
			if( NavyCraft.explosiveEggsList.contains((Egg)attacker) )
			{	
				event.setDamage(5);
			}
		}
	}

}
 
开发者ID:Maximuspayne,项目名称:NavyCraft2-Lite,代码行数:47,代码来源:MoveCraft_EntityListener.java

示例12: noFire

@EventHandler(priority = EventPriority.HIGH)
public void noFire(final BlockBurnEvent event) {
    event.setCancelled(true);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:EnvironmentControlListener.java

示例13: pickupItem

@EventHandler(priority = EventPriority.HIGH)
public void pickupItem(PlayerPickupItemEvent event) {
    event.setCancelled(true);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:EnvironmentControlListener.java

示例14: onBlockIgnite

@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onBlockIgnite(BlockIgniteEvent event) {
    if (event.getCause() == BlockIgniteEvent.IgniteCause.SPREAD) {
        event.setCancelled(true);
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:6,代码来源:WorldListener.java

示例15: onEntityDamage

@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onEntityDamage(EntityDamageEvent event) {
    Entity entity = event.getEntity();
    if (entity instanceof Player) {
        Player player = (Player) entity;
        Faction playerFactionAt = plugin.getFactionManager().getFactionAt(player.getLocation());
        EntityDamageEvent.DamageCause cause = event.getCause();
        if (playerFactionAt.isSafezone() && cause != EntityDamageEvent.DamageCause.SUICIDE && cause != EntityDamageEvent.DamageCause.VOID) {
            event.setCancelled(true);
        }

        Player attacker = BukkitUtils.getFinalAttacker(event, true);
        if (attacker != null) {
            Faction attackerFactionAt = plugin.getFactionManager().getFactionAt(attacker.getLocation());
            if (attackerFactionAt.isSafezone()) {
                event.setCancelled(true);
                attacker.sendMessage(ChatColor.RED + "You cannot attack players when in safe-zones.");
                return;
            } else if (playerFactionAt.isSafezone()) {
                // it's already cancelled above.
                attacker.sendMessage(ChatColor.RED + "You cannot attack players that are in safe-zones.");
                return;
            }

            PlayerFaction attackerFaction;
            PlayerFaction playerFaction = plugin.getFactionManager().getPlayerFaction(player);
            if (playerFaction != null && ((attackerFaction = plugin.getFactionManager().getPlayerFaction(attacker)) != null)) {
                Role role = playerFaction.getMember(player).getRole();
                String hiddenAstrixedName = role.getAstrix() + (player.hasPotionEffect(PotionEffectType.INVISIBILITY) ? "???" : player.getName());
                if (attackerFaction == playerFaction) {
                    event.setCancelled(true);
                } else if (attackerFaction.getAllied().contains(playerFaction.getUniqueID())) {
                    if (true) { // TODO: prevent ally damage.
                        event.setCancelled(true);
                        attacker.sendMessage(SettingsYML.ALLY_COLOUR + hiddenAstrixedName + ChatColor.YELLOW + " is an ally.");
                    } else {
                        attacker.sendMessage(ChatColor.YELLOW + "Careful! " + SettingsYML.ALLY_COLOUR + hiddenAstrixedName + ChatColor.YELLOW + " is an ally.");
                    }
                }
            }
        }
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:43,代码来源:ProtectionListener.java


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