mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-22 04:37:42 +01:00
Fixed Upgrading Recipes in Crafting Stations
This commit is contained in:
parent
dc431ea12d
commit
53908ed994
@ -8,6 +8,7 @@ import org.bukkit.configuration.ConfigurationSection;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import net.Indyuce.mmoitems.MMOItems;
|
import net.Indyuce.mmoitems.MMOItems;
|
||||||
|
import net.Indyuce.mmoitems.MMOUtils;
|
||||||
import net.Indyuce.mmoitems.api.crafting.ConfigMMOItem;
|
import net.Indyuce.mmoitems.api.crafting.ConfigMMOItem;
|
||||||
import net.Indyuce.mmoitems.api.crafting.CraftingStation;
|
import net.Indyuce.mmoitems.api.crafting.CraftingStation;
|
||||||
import net.Indyuce.mmoitems.api.crafting.IngredientInventory;
|
import net.Indyuce.mmoitems.api.crafting.IngredientInventory;
|
||||||
@ -47,6 +48,7 @@ public class UpgradingRecipe extends Recipe {
|
|||||||
recipe.getUpgraded().setItemMeta(recipe.getMMOItem().newBuilder().build().getItemMeta());
|
recipe.getUpgraded().setItemMeta(recipe.getMMOItem().newBuilder().build().getItemMeta());
|
||||||
|
|
||||||
uncastRecipe.getRecipe().getTriggers().forEach(trigger -> trigger.whenCrafting(data));
|
uncastRecipe.getRecipe().getTriggers().forEach(trigger -> trigger.whenCrafting(data));
|
||||||
|
Message.UPGRADE_SUCCESS.format(ChatColor.YELLOW, "#item#", MMOUtils.getDisplayName(recipe.getUpgraded())).send(data.getPlayer());
|
||||||
data.getPlayer().playSound(data.getPlayer().getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
|
data.getPlayer().playSound(data.getPlayer().getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,6 +75,8 @@ public class UpgradingRecipe extends Recipe {
|
|||||||
Message.UPGRADE_FAIL.format(ChatColor.RED).send(data.getPlayer());
|
Message.UPGRADE_FAIL.format(ChatColor.RED).send(data.getPlayer());
|
||||||
if (recipe.getUpgradeData().destroysOnFail())
|
if (recipe.getUpgradeData().destroysOnFail())
|
||||||
recipe.getUpgraded().setAmount(recipe.getUpgraded().getAmount() - 1);
|
recipe.getUpgraded().setAmount(recipe.getUpgraded().getAmount() - 1);
|
||||||
|
|
||||||
|
recipe.getIngredients().forEach(ingredient -> ingredient.getPlayerIngredient().reduceItem(ingredient.getIngredient().getAmount()));
|
||||||
data.getPlayer().playSound(data.getPlayer().getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 2);
|
data.getPlayer().playSound(data.getPlayer().getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 2);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public class Upgrade_Stat extends ItemStat {
|
|||||||
@Override
|
@Override
|
||||||
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
public boolean whenClicked(EditionInventory inv, InventoryClickEvent event) {
|
||||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||||
new UpgradingEdition(inv.getPlayer(), inv.getItemType(), inv.getItemId()).open(inv.getPreviousPage());
|
new UpgradingEdition(inv.getPlayer(), inv.getItemType(), inv.getItemId()).open(inv.getPage());
|
||||||
|
|
||||||
if (event.getAction() == InventoryAction.PICKUP_HALF) {
|
if (event.getAction() == InventoryAction.PICKUP_HALF) {
|
||||||
ConfigFile config = inv.getItemType().getConfigFile();
|
ConfigFile config = inv.getItemType().getConfigFile();
|
||||||
|
Loading…
Reference in New Issue
Block a user