public class QuestsManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private GuiStateListener |
guiStateListener
The
GuiStateListener for detecting established or dropped
connections. |
private EventListenerList2<QuestsManagerListener> |
listeners
The
QuestsManagerListeners to notify about
changes. |
private java.util.Comparator<Quest> |
questComparator
A
Comparator to compare Quest instances by title and
code. |
private java.util.List<Quest> |
quests
All quests.
|
Constructor and Description |
---|
QuestsManager(GuiStateManager guiStateManager)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addCrossfireQuestChangedListener(QuestsManagerListener listener)
Adds a
QuestsManagerListener to notify about changes. |
void |
addQuest(int code,
java.lang.String title,
int face,
boolean replay,
int parent,
boolean end,
java.lang.String description)
Adds a new quest.
|
boolean |
displaysFace(int faceNum)
Returns whether any quest has the given face.
|
Quest |
getQuest(int index)
Returns a
Quest instance by index. |
int |
getQuests()
Returns the number of current quests.
|
void |
removeCrossfireQuestChangedListener(QuestsManagerListener listener)
Removes a
QuestsManagerListener to notify about changes. |
void |
selectCharacter()
A character name was sent to the server.
|
void |
updateQuest(int code,
boolean end,
java.lang.String step)
Updates quest information.
|
@NotNull private final GuiStateListener guiStateListener
GuiStateListener
for detecting established or dropped
connections.@NotNull private final EventListenerList2<QuestsManagerListener> listeners
QuestsManagerListeners
to notify about
changes.@NotNull private final java.util.Comparator<Quest> questComparator
Comparator
to compare Quest
instances by title and
code.@NotNull private final java.util.List<Quest> quests
public QuestsManager(@NotNull GuiStateManager guiStateManager)
guiStateManager
- the gui state manager to watchpublic void addCrossfireQuestChangedListener(@NotNull QuestsManagerListener listener)
QuestsManagerListener
to notify about changes.listener
- the listener to addpublic void addQuest(int code, @NotNull java.lang.String title, int face, boolean replay, int parent, boolean end, @NotNull java.lang.String description)
code
- the quest's codetitle
- the quest's titleface
- the quest's facereplay
- whether the quest can be replayed or notparent
- quest internal code of this quest's parent, 0 if no
parent.end
- whether the quest is ended or notdescription
- the quest's current steppublic boolean displaysFace(int faceNum)
faceNum
- the face@Nullable public Quest getQuest(int index)
Quest
instance by index.index
- the indexnull
if the index is invalidpublic int getQuests()
public void removeCrossfireQuestChangedListener(@NotNull QuestsManagerListener listener)
QuestsManagerListener
to notify about changes.listener
- the listener to removepublic void selectCharacter()
public void updateQuest(int code, boolean end, @NotNull java.lang.String step)
code
- the quest's codeend
- whether the quest is ended or notstep
- the quest's current step