mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Update player inventory after crafting multiple ChimaeraWings
Fixes #864
This commit is contained in:
parent
5b5b73cde0
commit
8cf16d4a1c
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user