From 1df94f70015359fcac1ffaab16d5e66a57f59161 Mon Sep 17 00:00:00 2001 From: Eric Date: Sun, 18 Aug 2019 16:32:10 +0200 Subject: [PATCH] Allow setting amount or value in ShopBuySellEvent --- .../shopchest/api/event/ShopBuySellEvent.java | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/de/epiceric/shopchest/api/event/ShopBuySellEvent.java b/api/src/main/java/de/epiceric/shopchest/api/event/ShopBuySellEvent.java index 3365f3b..cd5aff4 100644 --- a/api/src/main/java/de/epiceric/shopchest/api/event/ShopBuySellEvent.java +++ b/api/src/main/java/de/epiceric/shopchest/api/event/ShopBuySellEvent.java @@ -34,7 +34,8 @@ public class ShopBuySellEvent extends ShopEvent implements Cancellable { } /** - * Gets the amount which might be modified because of automatic item amount calculation + * Gets the amount which might be modified because of automatic item amount + * calculation * * @return the amount * @since 1.13 @@ -44,7 +45,22 @@ public class ShopBuySellEvent extends ShopEvent implements Cancellable { } /** - * Gets the price which might be modified because of automatic item amount calculation + * Sets the amount of items the player will buy or sell + *

+ * This might not be equal to the amount specified in {@link Shop#getProduct()}. + * + * @param amount the amount + * @since 1.13 + */ + public void setAmount(int amount) { + this.amount = amount; + } + + /** + * Gets the price the player and the vendor of the shop will pay or receive + *

+ * This might not be equal to {@link Shop#getBuyPrice()} or + * {@link Shop#getSellPrice()}. * * @return the price * @since 1.13 @@ -53,6 +69,17 @@ public class ShopBuySellEvent extends ShopEvent implements Cancellable { return price; } + /** + * Sets the amount of money the player and the vendor of the shop will pay or + * receive + * + * @param price the price + * @since 1.13 + */ + public void setPrice(double price) { + this.price = price; + } + @Override public boolean isCancelled() { return cancelled; @@ -64,7 +91,6 @@ public class ShopBuySellEvent extends ShopEvent implements Cancellable { } public enum Type { - BUY, - SELL; + BUY, SELL; } }