public class SServerTrainer extends AbstractUDPClient implements ActionsTrainer
Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
SServerTrainer(String teamName,
ControllerTrainer t)
A part constructor for SServerTrainer (assumes localhost:6001)
|
SServerTrainer(String teamName,
ControllerTrainer t,
int port,
String hostname)
The full constructor for SServerTrainer
|
Modifier and Type | Method and Description |
---|---|
void |
bye()
This is used to disconnect a trainer from the server.
|
void |
changePlayerType(String teamName,
int unum,
int playerType)
This command changes a specified players type.
|
void |
changePlayMode(PlayMode playMode)
Changes the play mode of the current game.
|
void |
checkBall()
Checks the current status of the ball.
|
void |
connect()
Connects to the server via AbstractUDPClient.
|
void |
ear(boolean earOn)
Turns on or off the sending of auditory information from the server.
|
void |
eye(boolean eyeOn)
Turns on or off the sending of "(see_global ...)" information from the server.
|
String |
getInitMessage()
Returns the init message for this client.
|
void |
handleError(String error)
The method used to show errors.
|
void |
look()
This command provides information about the positions of the following objects on the field.
|
void |
moveBall(double x,
double y)
Moves the ball to the given coordinates.
|
void |
movePlayer(ActionsPlayer p,
double x,
double y)
Moves the given player to the given location.
|
void |
received(String msg)
Received a message.
|
void |
recover()
Recovers the players stamina, recovery, effort and hear capacity to the values at the beginning of the game.
|
void |
say(String message)
This command broadcasts the message throughout the field.
|
void |
startGame()
Starts the game.
|
void |
teamNames()
This command provides information about the names of both teams and which side they are playing on.
|
getDescription, isRunning, pauseMilliseconds, run, send, start, stopRunning, toStateString
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield
public SServerTrainer(String teamName, ControllerTrainer t)
teamName
- The team name.t
- A ControllerTrainer.public SServerTrainer(String teamName, ControllerTrainer t, int port, String hostname)
teamName
- The teams name.t
- A ControllerTrainer.port
- The port to connect to.hostname
- The host address.public String getInitMessage()
getInitMessage
in class AbstractUDPClient
public void connect()
public void received(String msg) throws IOException
received
in class AbstractUDPClient
msg
- The message received.IOException
- if any.public void changePlayMode(PlayMode playMode)
changePlayMode
in interface ActionsTrainer
playMode
- a PlayMode
object.public void movePlayer(ActionsPlayer p, double x, double y)
movePlayer
in interface ActionsTrainer
p
- The player to move.x
- The x coordinate.y
- The y coordinate.public void moveBall(double x, double y)
moveBall
in interface ActionsTrainer
x
- The x coordinate.y
- The y coordinate.public void checkBall()
checkBall
in interface ActionsTrainer
public void startGame()
startGame
in interface ActionsTrainer
public void recover()
recover
in interface ActionsTrainer
public void eye(boolean eyeOn)
eye
in interface ActionsTrainer
eyeOn
- True to turn (see_global on, false to turn it off.public void ear(boolean earOn)
ear
in interface ActionsTrainer
earOn
- True to turn auditory information on, false to turn it off.public void look()
look
in interface ActionsTrainer
public void teamNames()
teamNames
in interface ActionsTrainer
public void changePlayerType(String teamName, int unum, int playerType)
changePlayerType
in interface ActionsTrainer
teamName
- The team the player belongs to.unum
- The players uniform number (1~11 on pitch usually, subs <= 14).playerType
- A player type between 0 (the standard player) and 18. However, player.conf can change this.public void say(String message)
say
in interface ActionsTrainer
message
- A valid String to say.public void bye()
bye
in interface ActionsTrainer
public void handleError(String error)
handleError
in interface ActionsTrainer
error
- The error to show.Copyright © 2003–2015 Atan. All rights reserved.