Class VillagerGUI
java.lang.Object
de.marcely.bedwars.tools.gui.type.VillagerGUI
- All Implemented Interfaces:
GUI
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addCloseListener
(Consumer<Player> callback) Adds a close listener to the gui.boolean
addOffer
(VillagerOffer offer) Adds an offer that can be bought by a player.boolean
Returns if this type allows its items to get moved around and to be droppedvoid
clear()
Resets its contentvoid
closeAll()
Closes this GUI for any player@Nullable VillagerOffer
Returns the offer in this GUI whose id is equal to the given as a parameterReturns all offers that have been added to this GUI.Returns the player for whom the GUI is currently opengetTitle()
Returns the set titleReturns all registered trade events that were explicitly added to this GUI.boolean
Get whether the given player has the inventory currently openfinal void
Event method that's getting called whenever a player closes the inventoryvoid
Opens the GUI for the playerboolean
Registers a listener that will be called when a player successfully executes a trade.boolean
removeCloseListener
(Consumer<Player> callback) Removes a close listener from the gui.boolean
removeOffer
(VillagerOffer offer) Removes an existing offer.void
Set the title of the GUI.boolean
Unregisters an already registered trade listenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface de.marcely.bedwars.tools.gui.GUI
getCloseListeners, ignoresCancelEvent
-
Constructor Details
-
VillagerGUI
public VillagerGUI() -
VillagerGUI
-
-
Method Details
-
open
Description copied from interface:GUI
Opens the GUI for the player -
closeAll
public void closeAll()Description copied from interface:GUI
Closes this GUI for any player -
setTitle
Description copied from interface:GUI
Set the title of the GUI. Keep in mind that not every type supports this -
getTitle
Description copied from interface:GUI
Returns the set title -
areItemsMoveable
public boolean areItemsMoveable()Description copied from interface:GUI
Returns if this type allows its items to get moved around and to be dropped- Specified by:
areItemsMoveable
in interfaceGUI
- Returns:
- If the items are moveable/dragable
-
getPlayers
Description copied from interface:GUI
Returns the player for whom the GUI is currently open- Specified by:
getPlayers
in interfaceGUI
- Returns:
- The players for who the GUI has been opened
-
hasOpen
Description copied from interface:GUI
Get whether the given player has the inventory currently open -
addCloseListener
Description copied from interface:GUI
Adds a close listener to the gui. This listener will be called when a player closes the gui- Specified by:
addCloseListener
in interfaceGUI
- Parameters:
callback
- the listener that is being added- Returns:
- if the listener was added successfully
-
removeCloseListener
Description copied from interface:GUI
Removes a close listener from the gui.- Specified by:
removeCloseListener
in interfaceGUI
- Parameters:
callback
- the listener that is being removed- Returns:
- if the listener was removed successfully
-
clear
public void clear()Description copied from interface:GUI
Resets its content -
onClose
Description copied from interface:GUI
Event method that's getting called whenever a player closes the inventory -
getOffers
Returns all offers that have been added to this GUI.- Returns:
- All added offers
-
getOffer
Returns the offer in this GUI whose id is equal to the given as a parameter- Parameters:
id
- The id of the offer- Returns:
- The offer whose id is equal.
null
if there's none
-
addOffer
Adds an offer that can be bought by a player.Keep in mind that you'll have to reopen the GUI for it to get updated.
- Parameters:
offer
- The buyable offer given to the player- Returns:
false
if the offer has been already added before
-
removeOffer
Removes an existing offer.Keep in mind that you'll have to reopen the GUI for it to get updated.
- Parameters:
offer
- The offer that shall be removed- Returns:
true
if it has been removed
-
getTradeListeners
Returns all registered trade events that were explicitly added to this GUI.Keep in mind that those listeners get run AFTER Bukkit's event queue. Cancelling them causes these listeners to noWt get run.
It's safe to modify the returned set.
- Returns:
- All registered trade events that were explicitly added to this GUI
-
registerTradeListener
Registers a listener that will be called when a player successfully executes a trade.Keep in mind that the listener get run AFTER Bukkit's event queue. Cancelling them causes these listeners to noWt get run.
- Parameters:
listener
- The listener that shall be registered- Returns:
true
if it's not already registered
-
unregisterTradeListener
Unregisters an already registered trade listener- Parameters:
listener
- The listener that shall be unregistered- Returns:
false
if it's not registered
-