Update player inventory after crafting multiple ChimaeraWings

Fixes #864
This commit is contained in:
TfT_02 2013-03-22 11:22:03 +01:00
parent 5b5b73cde0
commit 8cf16d4a1c

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.event.inventory.FurnaceBurnEvent;
import org.bukkit.event.inventory.FurnaceExtractEvent;
import org.bukkit.event.inventory.FurnaceSmeltEvent;
@ -159,4 +160,29 @@ public class InventoryListener implements Listener {
public void onInventoryClickEvent(InventoryClickEvent event) {
SkillUtils.removeAbilityBuff(event.getCurrentItem());
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onCraftItem(CraftItemEvent event) {
if (event.getRecipe().getResult() == null) {
return;
}
else if (!ItemUtils.isChimaeraWing(event.getRecipe().getResult())) {
return;
}
else if (event.getWhoClicked() == null) {
return;
}
else if (!(event.getWhoClicked() instanceof Player)) {
return;
}
final Player player = (Player) event.getWhoClicked();
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
@Override
public void run() {
player.updateInventory();
}
});
}
}