Package de.marcely.bedwars.tools.gui
Class VillagerOffer
java.lang.Object
de.marcely.bedwars.tools.gui.VillagerOffer
Represents a buyable offer that can be added to a
VillagerGUI
-
Constructor Summary
ConstructorDescriptionVillagerOffer
(ItemStack result, ItemStack price1) VillagerOffer
(ItemStack result, ItemStack price1, @Nullable ItemStack price2) -
Method Summary
Modifier and TypeMethodDescriptionReturns the first item that the player must have and give to purchase the offergetId()
Returns a random unique id that's bound to this offerstatic UUID
Returns thegetId()
that will be used for the next constructed offerReturns the item that will be given to the player once he purchased it@Nullable ItemStack
Returns the optional second price that the player must have and give to purchase the offerboolean
Returns if a second unique price is required for the player to purchase the itemvoid
setFirstPrice
(ItemStack price1) Set the first price that will be taken from the player once he purchased the offervoid
Set the item that will be given to the player once the offer has been purchasedvoid
setSecondPrice
(@Nullable ItemStack price2) Set the new optional second price that will be taken from the player once he purchased the offer
-
Constructor Details
-
VillagerOffer
-
VillagerOffer
-
-
Method Details
-
getId
Returns a random unique id that's bound to this offer- Returns:
- The id of this offer
-
getResult
Returns the item that will be given to the player once he purchased it- Returns:
- The result of the offer
-
getFirstPrice
Returns the first item that the player must have and give to purchase the offer- Returns:
- The first price
-
getSecondPrice
Returns the optional second price that the player must have and give to purchase the offer- Returns:
- The second price.
null
ifhasSecondPrice()
returns false
-
hasSecondPrice
public boolean hasSecondPrice()Returns if a second unique price is required for the player to purchase the item- Returns:
true
if a second price is given
-
setResult
Set the item that will be given to the player once the offer has been purchased- Parameters:
result
- The new result item
-
setFirstPrice
Set the first price that will be taken from the player once he purchased the offer- Parameters:
price1
- The new first price
-
setSecondPrice
Set the new optional second price that will be taken from the player once he purchased the offer- Parameters:
price2
- The new second price. May be null if there shouldn't be a second one
-
getNextId
Returns thegetId()
that will be used for the next constructed offer- Returns:
- The id of the next offer
-