papermc/patches/api/0229-Add-ignore-discounts-API.patch
Nassim Jahnke 928bcc8d3a
Updated Upstream (Bukkit/CraftBukkit) (#8430)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
09943450 Update SnakeYAML version
5515734f SPIGOT-7162: Incorrect description for Entity#getVehicle javadoc
6f82b381 PR-788: Add getHand() to all relevant events

CraftBukkit Changes:
aaf484f6f SPIGOT-7163: CraftMerchantRecipe doesn't copy demand and specialPrice from BukkitMerchantRecipe
5329dd6fd PR-1107: Add getHand() to all relevant events
93061706e SPIGOT-7045: Ocelots never spawn with babies with spawn reason OCELOT_BABY
2022-10-02 09:56:36 +02:00

55 lines
2.5 KiB
Diff

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
index d33b66facf36587d703c29e9085289ce919ae621..afaa21b9347683fa373a938d9b1aa01c2058192a 100644
--- a/src/main/java/org/bukkit/inventory/MerchantRecipe.java
+++ b/src/main/java/org/bukkit/inventory/MerchantRecipe.java
@@ -57,6 +57,7 @@ public class MerchantRecipe implements Recipe {
private int demand;
private int villagerExperience;
private float priceMultiplier;
+ private boolean ignoreDiscounts; // Paper
public MerchantRecipe(@NotNull ItemStack result, int maxUses) {
this(result, 0, maxUses, false);
@@ -71,6 +72,15 @@ public class MerchantRecipe implements Recipe {
}
public MerchantRecipe(@NotNull ItemStack result, int uses, int maxUses, boolean experienceReward, int villagerExperience, float priceMultiplier, int demand, int specialPrice) {
+ // Paper start - add ignoreDiscounts param
+ this(result, uses, maxUses, experienceReward, villagerExperience, priceMultiplier, demand, specialPrice, false);
+ }
+ public MerchantRecipe(@NotNull ItemStack result, int uses, int maxUses, boolean experienceReward, int villagerExperience, float priceMultiplier, boolean ignoreDiscounts) {
+ 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) {
+ this.ignoreDiscounts = ignoreDiscounts;
+ // Paper end
this.result = result;
this.uses = uses;
this.maxUses = maxUses;
@@ -283,4 +293,20 @@ public class MerchantRecipe implements Recipe {
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
}