public class PendingDirections
extends java.lang.Object
In case the server does not execute the movement command (for example because the character was stopped by an obstacle), the pending movements are cleared.
Constructor and Description |
---|
PendingDirections()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int direction,
int packetNo)
Adds a pending step.
|
void |
clear()
Clears the state.
|
void |
comc(int packetNo)
Must be called when a comc message has been received from the server.
|
@NotNull java.lang.Iterable<java.lang.Integer> |
getPendingDirections()
Returns the currently pending directions.
|
int |
getRunDirection()
Returns the direction the character is running.
|
void |
mapScroll(int direction)
Must be called when the map has been scrolled.
|
void |
run(int direction)
Sets the directions the character is currently running to.
|
void |
tick()
Must be called when a tick message has been received.
|
@NotNull java.lang.String |
toString() |
@NotNull public @NotNull java.lang.Iterable<java.lang.Integer> getPendingDirections()
public int getRunDirection()
public void clear()
public void add(int direction, int packetNo)
direction
- the direction of the steppacketNo
- the packet number for tracking responsespublic void run(int direction)
direction
- the direction or -1 when not runningpublic void comc(int packetNo)
packetNo
- the packet numberpublic void mapScroll(int direction)
direction
- the scrolling directionpublic void tick()
@NotNull public @NotNull java.lang.String toString()
toString
in class java.lang.Object