mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-03 06:37:47 +01:00
Merge branch '1149-crafting-stations-bugged-for-money' into 'master'
Vault refund added See merge request phoenix-dvpmt/mmoitems!68
This commit is contained in:
commit
e698e6f298
@ -31,4 +31,8 @@ public class MoneyCondition extends Condition {
|
||||
public void whenCrafting(PlayerData data) {
|
||||
MMOItems.plugin.getVault().getEconomy().withdrawPlayer(data.getPlayer(), amount);
|
||||
}
|
||||
|
||||
public double getAmount() {
|
||||
return amount;
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import net.Indyuce.mmoitems.api.crafting.recipe.Recipe;
|
||||
import net.Indyuce.mmoitems.api.event.PlayerUseCraftingStationEvent;
|
||||
import net.Indyuce.mmoitems.api.item.util.ConfigItems;
|
||||
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
import net.Indyuce.mmoitems.comp.eco.MoneyCondition;
|
||||
import net.Indyuce.mmoitems.listener.CustomSoundListener;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -221,6 +222,13 @@ public class CraftingStationView extends PluginInventory {
|
||||
// Give ingredients back
|
||||
for (Ingredient ingredient : recipeInfo.getRecipe().getIngredients())
|
||||
new SmartGive(player).give(ingredient.generateItemStack(playerData.getRPG()));
|
||||
|
||||
// Give money back
|
||||
recipe.getConditions()
|
||||
.stream()
|
||||
.filter(condition -> condition instanceof MoneyCondition)
|
||||
.map(condition -> (MoneyCondition) condition)
|
||||
.forEach(condition -> MMOItems.plugin.getVault().getEconomy().depositPlayer(player, condition.getAmount()));
|
||||
}
|
||||
|
||||
updateData();
|
||||
|
Loading…
Reference in New Issue
Block a user