Triggers now apply when using the recipe (not when claiming item from the queue)

This commit is contained in:
Jules 2022-03-01 14:29:35 +01:00
parent dccfcbb2b8
commit 6c9b02bc8a
3 changed files with 1 additions and 5 deletions

View File

@ -200,7 +200,6 @@ public class CraftingRecipe extends Recipe {
if (result != null)
new SmartGive(data.getPlayer()).give(result);
recipe.getRecipe().getTriggers().forEach(trigger -> trigger.whenCrafting(data));
// Play sound
if (!hasOption(RecipeOption.SILENT_CRAFT))

View File

@ -56,7 +56,6 @@ public class UpgradingRecipe extends Recipe {
recipe.getUpgradeData().upgrade(recipe.getMMOItem());
recipe.getUpgraded().setItemMeta(recipe.getMMOItem().newBuilder().build().getItemMeta());
castRecipe.getRecipe().getTriggers().forEach(trigger -> trigger.whenCrafting(data));
Message.UPGRADE_SUCCESS.format(ChatColor.YELLOW, "#item#", MMOUtils.getDisplayName(recipe.getUpgraded())).send(data.getPlayer());
// Play sound

View File

@ -191,9 +191,6 @@ public class CraftingStationView extends PluginInventory {
// Remove from crafting queue
playerData.getCrafting().getQueue(station).remove(recipeInfo);
// Apply triggers
recipe.getTriggers().forEach(trigger -> trigger.whenCrafting(playerData));
// Play sounds
CustomSoundListener.stationCrafting(result, player);
if (!recipe.hasOption(Recipe.RecipeOption.SILENT_CRAFT))
@ -250,6 +247,7 @@ public class CraftingStationView extends PluginInventory {
if (recipe.getRecipe().whenUsed(playerData, ingredients, recipe, station)) {
recipe.getIngredients().forEach(ingredient -> ingredient.takeAway());
recipe.getConditions().forEach(condition -> condition.getCondition().whenCrafting(playerData));
recipe.getRecipe().getTriggers().forEach(trigger -> trigger.whenCrafting(playerData));
updateData();
}