public abstract class GuiStateManager
extends java.lang.Object
GuiState
. Notifies registered listeners about
changes.Modifier | Constructor and Description |
---|---|
protected |
GuiStateManager()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addGuiStateListener(@NotNull GuiStateListener listener)
Adds a gui state listener.
|
void |
changeGUI(@NotNull GuiState guiState)
Sets a new
GuiState . |
void |
connect(@NotNull java.lang.String serverInfo)
Connects to a Crossfire server.
|
void |
disconnect()
Disconnects from the Crossfire server.
|
void |
disconnected()
Called after the connection has been closed.
|
void |
disconnecting(@NotNull java.lang.String reason,
boolean isError)
Called when the connection is being torn down.
|
protected abstract void |
doChangeGUI(@NotNull java.lang.Runnable runnable)
Calls the
Runnable . |
@Nullable GuiState |
getGuiState()
Returns the current
GuiState . |
void |
removeGuiStateListener(@NotNull GuiStateListener listener)
Removes a gui state listener.
|
void |
setClientSocketState(@NotNull ClientSocketState clientSocketState,
@NotNull java.lang.String param)
Sets the new
ClientSocketState . |
public void changeGUI(@NotNull @NotNull GuiState guiState)
GuiState
.guiState
- the new gui stateprotected abstract void doChangeGUI(@NotNull @NotNull java.lang.Runnable runnable)
Runnable
.runnable
- the runnable@Nullable public @Nullable GuiState getGuiState()
GuiState
.public void addGuiStateListener(@NotNull @NotNull GuiStateListener listener)
listener
- the listener to addpublic void removeGuiStateListener(@NotNull @NotNull GuiStateListener listener)
listener
- the listener to removepublic void connect(@NotNull @NotNull java.lang.String serverInfo)
serverInfo
- the server to connect topublic void disconnect()
public void setClientSocketState(@NotNull @NotNull ClientSocketState clientSocketState, @NotNull @NotNull java.lang.String param)
ClientSocketState
.clientSocketState
- the new stateparam
- additional information; currently only used in state
ClientSocketState.REQUESTINFO
public void disconnecting(@NotNull @NotNull java.lang.String reason, boolean isError)
reason
- the disconnect reasonisError
- whether the disconnect is unexpectedpublic void disconnected()