Java 类org.bukkit.event.player.PlayerPickupArrowEvent 实例源码

项目:ProjectAres    文件:ItemModifyMatchModule.java   
@EventHandler
public void onArrowPickup(PlayerPickupArrowEvent event) {
    // Only needed for players picking up arrows stuck in blocks
    final ItemStack item = event.getItem().getItemStack();
    if(applyRules(item)) {
        event.getItem().setItemStack(item);
    }
}
项目:Murder    文件:GameListenerArrow.java   
@EventHandler
public void on(PlayerPickupArrowEvent event) {
    Player player = event.getPlayer();
    PlayerData data = plugin.playerManager.getData(player.getUniqueId());
    if (data != null) {
        if (data.isInGame()) {
            if (event.getArrow() != null) {
                if (event.getArrow().hasMetadata("MURDER")) {
                    event.setCancelled(true);
                    event.getArrow().remove();
                }
            }
        }
    }
}
项目:SpigotSource    文件:EntityArrow.java   
public void d(EntityHuman entityhuman) {
    if (!this.world.isClientSide && this.inGround && this.shake <= 0) {
        // CraftBukkit start
        ItemStack itemstack = new ItemStack(Items.ARROW);
        if (this.fromPlayer == PickupStatus.ALLOWED && entityhuman.inventory.canHold(itemstack) > 0) {
            EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);

            PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), this, item), (org.bukkit.entity.Arrow) this.getBukkitEntity());
            // event.setCancelled(!entityhuman.canPickUpLoot); TODO
            this.world.getServer().getPluginManager().callEvent(event);

            if (event.isCancelled()) {
                return;
            }
        }
        // CraftBukkit end
        boolean flag = this.fromPlayer == EntityArrow.PickupStatus.ALLOWED || this.fromPlayer == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.abilities.canInstantlyBuild;

        if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(this.j())) {
            flag = false;
        }

        if (flag) {
            this.a(SoundEffects.cV, 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
            entityhuman.receive(this, 1);
            this.die();
        }

    }
}
项目:Warzone    文件:SpectatorModule.java   
@EventHandler
public void onPickupArrow(PlayerPickupArrowEvent event) {
    if (isSpectating(event.getPlayer())) {
        event.setCancelled(true);
    }
}
项目:AthenaGM    文件:SpectatorModule.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerPickupArrow(PlayerPickupArrowEvent event) {
    if (!isPlayerSpectator(event.getPlayer())) return;
    event.setCancelled(true);
}
项目:Arcade2    文件:ObserverListeners.java   
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerPickupArrow(PlayerPickupArrowEvent event) {
    if (this.isObserving(event.getPlayer())) {
        event.setCancelled(true);
    }
}