Subtraction goes down, not up. Silly me.

This commit is contained in:
Aikar 2018-06-30 04:45:17 -04:00
parent b922ff9886
commit 5659d66915
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE

View file

@ -1,11 +1,11 @@
From 79f36b1b98d9b888c633ef39dc73b532c89691b9 Mon Sep 17 00:00:00 2001
From 503daef70a79ca4ea4f0583e6442c17aa74a94ee Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 22 Jun 2018 22:59:18 -0400
Subject: [PATCH] ItemStack API additions for quantity/flags/lore
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 82240129..bfd6307f 100644
index 82240129..574cdf3b 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -2,7 +2,9 @@ package org.bukkit.inventory;
@ -85,7 +85,7 @@ index 82240129..bfd6307f 100644
+ * @return The same item (not a clone)
+ */
+ public ItemStack subtract(int qty) {
+ setAmount(Math.max(0, getAmount() + qty));
+ setAmount(Math.max(0, getAmount() - qty));
+ return this;
+ }
+
@ -162,5 +162,5 @@ index 82240129..bfd6307f 100644
// Paper end
}
--
2.17.1
2.18.0