mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Clean this up a bit.
This commit is contained in:
parent
822e40bc1f
commit
eba6820ec6
@ -163,26 +163,18 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onCraftItem(CraftItemEvent event) {
|
public void onCraftItem(CraftItemEvent event) {
|
||||||
if (event.getRecipe().getResult() == null) {
|
ItemStack result = event.getRecipe().getResult();
|
||||||
return;
|
final HumanEntity whoClicked = event.getWhoClicked();
|
||||||
}
|
|
||||||
else if (!ItemUtils.isMcMMOItem(event.getRecipe().getResult())) {
|
if (!ItemUtils.isMcMMOItem(result) || Misc.isNPCEntity(whoClicked) || !(whoClicked instanceof Player)) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (event.getWhoClicked() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (!(event.getWhoClicked() instanceof Player)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Player player = (Player) event.getWhoClicked();
|
mcMMO.p.getServer().getScheduler().runTaskLater(mcMMO.p, new Runnable() {
|
||||||
|
|
||||||
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
player.updateInventory();
|
((Player) whoClicked).updateInventory();
|
||||||
}
|
}
|
||||||
});
|
}, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user