Allow setting amount or value in ShopBuySellEvent

This commit is contained in:
Eric 2019-08-18 16:32:10 +02:00
parent d09fc71a49
commit 1df94f7001

View File

@ -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
* <p>
* 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
* <p>
* 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;
}
}