2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mariell Hoversholm <proximyst@proximyst.com>
Date: Mon, 9 Nov 2020 20:33:38 +0100
Subject: [PATCH] Add ignore discounts API
diff --git a/src/main/java/org/bukkit/inventory/MerchantRecipe.java b/src/main/java/org/bukkit/inventory/MerchantRecipe.java
2021-12-20 23:46:51 +01:00
index 620a4df8166be7a17ba4546f5d705114490c2526..c52326961a163c552025456bcadc1c897e08deb0 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/inventory/MerchantRecipe.java
+++ b/src/main/java/org/bukkit/inventory/MerchantRecipe.java
2021-12-20 23:46:51 +01:00
@@ -59,6 +59,7 @@ public class MerchantRecipe implements Recipe {
private int demand;
2021-06-11 14:02:28 +02:00
private int villagerExperience;
private float priceMultiplier;
+ private boolean ignoreDiscounts; // Paper
public MerchantRecipe(@NotNull ItemStack result, int maxUses) {
this(result, 0, maxUses, false);
2021-12-20 23:46:51 +01:00
@@ -73,6 +74,15 @@ public class MerchantRecipe implements Recipe {
2021-06-11 14:02:28 +02:00
}
2021-12-20 23:46:51 +01:00
public MerchantRecipe(@NotNull ItemStack result, int uses, int maxUses, boolean experienceReward, int villagerExperience, float priceMultiplier, int demand, int specialPrice) {
2021-06-11 14:02:28 +02:00
+ // Paper start - add ignoreDiscounts param
2021-12-20 23:46:51 +01:00
+ this(result, uses, maxUses, experienceReward, villagerExperience, priceMultiplier, demand, specialPrice, false);
2021-06-11 14:02:28 +02:00
+ }
+ public MerchantRecipe(@NotNull ItemStack result, int uses, int maxUses, boolean experienceReward, int villagerExperience, float priceMultiplier, boolean ignoreDiscounts) {
2021-12-20 23:46:51 +01:00
+ this(result, uses, maxUses, experienceReward, villagerExperience, priceMultiplier, 0, 0, ignoreDiscounts);
+ }
+ public MerchantRecipe(@NotNull ItemStack result, int uses, int maxUses, boolean experienceReward, int villagerExperience, float priceMultiplier, int demand, int specialPrice, boolean ignoreDiscounts) {
2021-06-11 14:02:28 +02:00
+ this.ignoreDiscounts = ignoreDiscounts;
+ // Paper end
this.result = result;
this.uses = uses;
this.maxUses = maxUses;
2021-12-20 23:46:51 +01:00
@@ -298,4 +308,20 @@ public class MerchantRecipe implements Recipe {
2021-06-11 14:02:28 +02:00
public void setPriceMultiplier(float priceMultiplier) {
this.priceMultiplier = priceMultiplier;
}
+
+ // Paper start
+ /**
+ * @return Whether all discounts on this trade should be ignored.
+ */
+ public boolean shouldIgnoreDiscounts() {
+ return ignoreDiscounts;
+ }
+
+ /**
+ * @param ignoreDiscounts Whether all discounts on this trade should be ignored.
+ */
+ public void setIgnoreDiscounts(boolean ignoreDiscounts) {
+ this.ignoreDiscounts = ignoreDiscounts;
+ }
+ // Paper end
}