Class VillagerGUI
java.lang.Object
de.marcely.bedwars.tools.gui.type.VillagerGUI
- All Implemented Interfaces:
GUI
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddCloseListener(Consumer<Player> callback) Adds a close listener to the gui.booleanaddOffer(VillagerOffer offer) Adds an offer that can be bought by a player.booleanReturns if this type allows its items to get moved around and to be droppedvoidclear()Resets its contentvoidcloseAll()Closes this GUI for any player@Nullable VillagerOfferReturns 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.booleanGet whether the given player has the inventory currently openfinal voidEvent method that's getting called whenever a player closes the inventoryvoidOpens the GUI for the playerbooleanRegisters a listener that will be called when a player successfully executes a trade.booleanremoveCloseListener(Consumer<Player> callback) Removes a close listener from the gui.booleanremoveOffer(VillagerOffer offer) Removes an existing offer.voidSet the title of the GUI.booleanUnregisters an already registered trade listenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.marcely.bedwars.tools.gui.GUI
getCloseListeners, ignoresCancelEvent
-
Constructor Details
-
VillagerGUI
public VillagerGUI() -
VillagerGUI
-
-
Method Details
-
open
Description copied from interface:GUIOpens the GUI for the player -
closeAll
public void closeAll()Description copied from interface:GUICloses this GUI for any player -
setTitle
Description copied from interface:GUISet the title of the GUI. Keep in mind that not every type supports this -
getTitle
Description copied from interface:GUIReturns the set title -
areItemsMoveable
public boolean areItemsMoveable()Description copied from interface:GUIReturns if this type allows its items to get moved around and to be dropped- Specified by:
areItemsMoveablein interfaceGUI- Returns:
- If the items are moveable/dragable
-
getPlayers
Description copied from interface:GUIReturns the player for whom the GUI is currently open- Specified by:
getPlayersin interfaceGUI- Returns:
- The players for who the GUI has been opened
-
hasOpen
Description copied from interface:GUIGet whether the given player has the inventory currently open -
addCloseListener
Description copied from interface:GUIAdds a close listener to the gui. This listener will be called when a player closes the gui- Specified by:
addCloseListenerin interfaceGUI- Parameters:
callback- the listener that is being added- Returns:
- if the listener was added successfully
-
removeCloseListener
Description copied from interface:GUIRemoves a close listener from the gui.- Specified by:
removeCloseListenerin interfaceGUI- Parameters:
callback- the listener that is being removed- Returns:
- if the listener was removed successfully
-
clear
public void clear()Description copied from interface:GUIResets its content -
onClose
Description copied from interface:GUIEvent 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.
nullif 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:
falseif 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:
trueif 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:
trueif it's not already registered
-
unregisterTradeListener
Unregisters an already registered trade listener- Parameters:
listener- The listener that shall be unregistered- Returns:
falseif it's not registered
-