 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.server.crossfire;
28 import org.jetbrains.annotations.NotNull;
29 import org.jetbrains.annotations.Nullable;
60 private final Object
sync =
new Object();
105 synchronized (
sync) {
123 final int numLookObjects;
124 synchronized (
sync) {
165 if (value.equals(
"FALSE")) {
166 System.err.println(
"Warning: the server is too old for this client since it does not support the num_look_objects setup option.");
167 System.err.println(
"Expect issues with the ground view display.");
168 synchronized (
sync) {
176 final int thisNumLookObjects;
178 thisNumLookObjects = Integer.parseInt(value);
179 }
catch (
final NumberFormatException ignored) {
182 final boolean negotiate;
183 synchronized (
sync) {
185 System.err.println(
"the server sent an unexpected 'setup num_look_objects "+value+
"'.");
189 System.err.println(
"Warning: the server didn't accept the num_look_objects setup option: requested "+
pendingNumLookObjects+
", returned "+thisNumLookObjects+
".");
190 System.err.println(
"Expect issues with the ground view display.");
218 synchronized (
sync) {
220 if (this.preferredNumLookObjects == preferredNumLookObjects2) {
224 this.preferredNumLookObjects = preferredNumLookObjects2;
235 synchronized (
sync) {
247 synchronized (
sync) {
259 synchronized (
sync) {
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
void negotiateNumLookObjects()
Requests a change of the number of ground objects from the server.
int currentNumLookObjects
The currently active number of ground view objects.
void processSetupNumLookObjects(@NotNull final String value)
Called when a "setup num_look_objects" response has been received from the server.
void connected()
Called after the server connection has been established.
NumLookObjects(@NotNull final CrossfireServerConnection crossfireServerConnection, @Nullable final DebugWriter debugProtocol)
Creates a new instance.
final DebugWriter debugProtocol
The appender to write protocol commands to.
void debugProtocolWrite(@NotNull final CharSequence str)
Writes a message to the debug protocol.
void setClientSocketState(@NotNull final ClientSocketState clientSocketState)
Called whenever the client socket state has changed.
int preferredNumLookObjects
The number of ground view objects to be negotiated with the server.
void setPreferredNumLookObjects(final int preferredNumLookObjects)
Sets the preferred number of ground items.
final Object sync
The synchronization objects for accessing mutable fields.
int getCurrentNumLookObjects()
Returns the current number of ground items.
An UnknownCommandException is generated whenever an unknown message packet is received from the serve...
boolean pending
Whether negotiation may be pending.
Writer debug information to a log file.
void waitForCurrentNumLookObjectsValid()
Waits until getCurrentNumLookObjects() is stable.
Connection progress states of the Crossfire server connection.
static final int DEFAULT_NUM_LOOK_OBJECTS
The default number of ground objects when no "setup num_look_objects" command has been sent.
void sendSetup(@NotNull String... options)
Sends a "setup" command to the server.
boolean connected
Whether the current client socket state is ClientSocketState#CONNECTED.
final CrossfireServerConnection crossfireServerConnection
The CrossfireServerConnection for sending "setup" commands.
Negotiates the size of the ground view in items with the Crossfire server.
CONNECTED
Connection is fully established.
int pendingNumLookObjects
The number of ground view objects being negotiated with the server.