T
- The type that will be used to check if your ticket matchespublic abstract class SimpleTicket<T>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private ITicketManager<T>[] |
dummyManagers |
protected boolean |
isValid |
private ITicketManager<T> |
masterManager |
Constructor and Description |
---|
SimpleTicket() |
Modifier and Type | Method and Description |
---|---|
protected void |
forEachManager(java.util.function.Consumer<ITicketManager<T>> consumer) |
protected ITicketManager<T>[] |
getDummyManagers() |
protected ITicketManager<T> |
getMasterManager() |
void |
invalidate()
Removes the ticket from the managing system.
|
boolean |
isValid()
Checks if your ticket is still registered in the system.
|
abstract boolean |
matches(T toMatch) |
void |
setManager(ITicketManager<T> masterManager,
ITicketManager<T>... dummyManagers)
Internal method that sets the collection from the managing system.
|
boolean |
unload(ITicketManager<T> unloadingManager)
Called by the managing system when a ticket wishes to unload all of it's tickets, e.g.
|
void |
validate()
Re-adds your ticket to the system.
|
@Nullable private ITicketManager<T> masterManager
private ITicketManager<T>[] dummyManagers
protected boolean isValid
@SafeVarargs public final void setManager(@Nonnull ITicketManager<T> masterManager, @Nonnull ITicketManager<T>... dummyManagers)
FarmlandWaterManager
public boolean isValid()
public void invalidate()
isValid()
should return false unless it is registered again using validate()
public boolean unload(ITicketManager<T> unloadingManager)
unloadingManager
- The manager that is unloading this ticketpublic void validate()
public abstract boolean matches(T toMatch)
protected final void forEachManager(java.util.function.Consumer<ITicketManager<T>> consumer)
protected final ITicketManager<T> getMasterManager()
protected final ITicketManager<T>[] getDummyManagers()