Interface OpenResponse<SIV extends SpectatorInventoryView<?>>
public interface OpenResponse<SIV extends SpectatorInventoryView<?>>
Much like SpectateResponse, this class represents the result of opening a SpectatorInventory.
An OpenResponse can either be open or closed. If it is open, then getOpenInventory() will return a SpectatorInventoryView normally.
If the OpenResponse is closed, then getReason() will tell you the reason why the SpectatorInventory could not be opened.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic <SIV extends SpectatorInventoryView<?>>
OpenResponse<SIV> closed(NotOpenedReason reason) Create a closed OpenResponseGet theSpectatorInventoryViewassociated with the opened inventory.Get theNotOpenedReasonassociated with the failed open attempt.booleanisOpen()Get whether the SpectatorInventory could be opened successfully.static <SIV extends SpectatorInventoryView<?>>
OpenResponse<SIV> ofNullable(SIV nullableView, NotOpenedReason ifNull) Deprecated.static <SIV extends SpectatorInventoryView<?>>
OpenResponse<SIV> open(SIV inventoryView) Create an open OpenResponse
-
Method Details
-
isOpen
boolean isOpen()Get whether the SpectatorInventory could be opened successfully.- Returns:
- true if the inventory could be opened successfully, otherwise false
-
getOpenInventory
Get theSpectatorInventoryViewassociated with the opened inventory.- Returns:
- the spectator inventory view
- Throws:
NoSuchElementException- if this response is closed.
-
getReason
Get theNotOpenedReasonassociated with the failed open attempt.- Returns:
- the reason
- Throws:
NoSuchElementException- if this response is open.
-
open
Create an open OpenResponse- Type Parameters:
SIV- the spectator inventory view type- Parameters:
inventoryView- the window which is opened.- Returns:
- a new open OpenResponse
-
closed
Create a closed OpenResponse- Type Parameters:
SIV- the spectator inventory type- Parameters:
reason- the reason why a window could not be opened.- Returns:
- a new closed OpenResponse
-
ofNullable
@Deprecated static <SIV extends SpectatorInventoryView<?>> OpenResponse<SIV> ofNullable(SIV nullableView, NotOpenedReason ifNull) Deprecated.
-