From 32a52e4f3fdf131199f3f66afc91ec35393d5b89 Mon Sep 17 00:00:00 2001 From: Shevchik Date: Wed, 5 Mar 2014 23:43:39 +0400 Subject: [PATCH] Move pickup delay check up --- src/com/cnaude/chairs/sitaddons/ChairEffects.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/com/cnaude/chairs/sitaddons/ChairEffects.java b/src/com/cnaude/chairs/sitaddons/ChairEffects.java index 61075c8..5ba2dce 100644 --- a/src/com/cnaude/chairs/sitaddons/ChairEffects.java +++ b/src/com/cnaude/chairs/sitaddons/ChairEffects.java @@ -6,6 +6,7 @@ package com.cnaude.chairs.sitaddons; import org.bukkit.Bukkit; import org.bukkit.entity.Entity; +import org.bukkit.entity.ExperienceOrb; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerPickupItemEvent; @@ -89,12 +90,12 @@ public class ChairEffects { if (plugin.getPlayerSitData().isSitting(p)) { for (Entity entity : p.getNearbyEntities(1, 2, 1)) { if (entity instanceof Item) { - if (p.getInventory().firstEmpty() != -1) { - Item item = (Item) entity; - PlayerPickupItemEvent pickupevent = new PlayerPickupItemEvent(p, item, 0); - Bukkit.getPluginManager().callEvent(pickupevent); - if (!pickupevent.isCancelled()) { - if (item.getPickupDelay() == 0) { + Item item = (Item) entity; + if (item.getPickupDelay() == 0) { + if (p.getInventory().firstEmpty() != -1) { + PlayerPickupItemEvent pickupevent = new PlayerPickupItemEvent(p, item, 0); + Bukkit.getPluginManager().callEvent(pickupevent); + if (!pickupevent.isCancelled()) { p.getInventory().addItem(item.getItemStack()); entity.remove(); }