|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.event.WindowAdapter
sarj.Sarj
public class Sarj
The main SARJ application class
Field Summary | |
---|---|
static javax.swing.ImageIcon |
CANCEL_ICON
|
static javax.swing.ImageIcon |
OK_ICON
|
Constructor Summary | |
---|---|
Sarj()
|
Method Summary | |
---|---|
void |
clearConsole()
Clears the console on the main window |
void |
connectClient()
Connects the client to the IP and port displayed on the main window |
void |
connectClient(java.lang.String ip,
int port)
Connects the client to the specified IP and port |
void |
disconnectClient()
Disconnects the client from any connected server |
void |
dispatchScript(java.lang.String scriptFile)
Runs the specified script file |
static java.lang.String |
formatTime(int seconds)
Formats seconds into mm:ss format |
java.lang.String |
getCommandBox()
Returns the value of the command combo box on the main window |
java.lang.String |
getCurrentMap()
Returns the name of the map currently being played on the server |
java.lang.String |
getGameType()
Returns the type of game running on the server |
java.lang.String |
getIPField()
Returns the value of the IP field on the main window |
int |
getNumPlayers()
Returns the number of players connected to the server |
java.lang.String |
getPasswordField()
Returns the current value stored in the password field on the main window |
java.lang.String[][] |
getPlayerData()
Returns all data within the player table on the main window |
java.lang.String[] |
getPlayerData(java.lang.String playerName)
Returns the row of the player table with the player name matching that provided |
java.lang.String |
getPortField()
Returns the value of the port field on the main window |
int |
getScoreLimit()
Returns the score limit of the game |
java.lang.String[][] |
getTeamData()
Returns all data within the team table on the main window |
java.lang.String[] |
getTeamData(java.lang.String teamName)
Returns the row of the team table with the team name matching that provided |
int |
getTimeLeft()
Returns the time left within the current game |
int |
getTimeLimit()
Returns the time limit of the current game |
java.lang.String |
getWindowTitle()
Returns the main SARJ window title |
static Sarj |
instance()
Returns the instance of the SARJ program |
static void |
main(java.lang.String[] args)
The main method |
void |
onAction(int actionID)
Called when the Perform button is clicked on the GUI |
void |
onAddAdmin(java.lang.String playerIP)
Called when the user chooses to add a player to the remote administrators list |
void |
onBanPlayer(int playerNumber)
Called when the user chooses to ban a player from the list of currently connected players |
void |
onCommand(java.lang.String command)
Called when a command is sent from the user |
void |
onConnect(java.lang.String address,
int port,
java.lang.String password)
Called when the Connect button is clicked on the GUI |
void |
onConnected()
Called when a connection is successfully established with a server, as a result of calling the connect method of a Connection object. |
void |
onDisconnect()
Called when the Disconnect button is clicked on the GUI |
void |
onDisconnected()
Called when a connection to a server is lost, either gracefully or due to error |
void |
onError(java.lang.String message)
Called when a connection error occurrs |
void |
onExit()
Called when the Exit button is clicked on the GUI, or the main GUI window is closed |
void |
onKickPlayer(int playerNumber)
Called when the user chooses to kick a player from the list of currently connected players |
void |
onRefresh()
Called when the Refresh button is clicked on the GUI, or the refresh timer triggers |
void |
onRemoveAdmin(java.lang.String playerIP)
Called when the user chooses to remove a player from the remote administrators list |
void |
onScriptButtonClick(java.lang.String name,
java.lang.String scriptFile)
Called when the user clicks on a ScriptButton |
void |
onSetTeam(int playerNumber,
int teamNumber)
Called when the user chooses to assign a connected player to a particular team |
static void |
printError(java.lang.String errorString)
Displays error messages |
void |
run()
Called when the main execution thread is started by a call to Thread.start() |
protected void |
Sarj()
Default constructor |
void |
sendData(java.lang.String data)
Sends data to a connected server |
void |
setCommandBox(java.lang.String command)
Sets the command combo box field on the main window |
void |
setIPField(java.lang.String ip)
Sets the IP field on the main window |
void |
setPasswordField(java.lang.String password)
Sets the password field on the main window |
void |
setPortField(java.lang.String port)
Sets the port field on the main window |
void |
setWindowTitle(java.lang.String title)
Sets the main SARJ window title to that specified |
void |
writeToConsole(java.lang.String text)
Writes text to the main command console |
Methods inherited from class java.awt.event.WindowAdapter |
---|
windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowGainedFocus, windowIconified, windowLostFocus, windowOpened, windowStateChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static javax.swing.ImageIcon OK_ICON
public static javax.swing.ImageIcon CANCEL_ICON
Constructor Detail |
---|
public Sarj()
Method Detail |
---|
public static void main(java.lang.String[] args)
protected void Sarj()
public static Sarj instance()
public void run()
run
in interface java.lang.Runnable
public static void printError(java.lang.String errorString)
errorString
- the error message to displaypublic void onConnect(java.lang.String address, int port, java.lang.String password)
onConnect
in interface GUIListener
address
- the address of the Soldat server, in dotted IP format
(X.X.X.X)port
- the port number of the Soldat serverpassword
- the remote administration password for the serverpublic void onDisconnect()
onDisconnect
in interface GUIListener
public void onExit()
onExit
in interface GUIListener
public void onAction(int actionID)
onAction
in interface GUIListener
actionID
- the ID of the action to be performedpublic void onRefresh()
onRefresh
in interface GUIListener
public void onCommand(java.lang.String command)
onCommand
in interface GUIListener
command
- the command string issued by the userpublic void onKickPlayer(int playerNumber)
onKickPlayer
in interface GUIListener
playerNumber
- the unique in-game ID number of the playerpublic void onBanPlayer(int playerNumber)
onBanPlayer
in interface GUIListener
playerNumber
- the unique in-game ID number of the playerpublic void onAddAdmin(java.lang.String playerIP)
onAddAdmin
in interface GUIListener
playerIP
- the IP address of the playerpublic void onRemoveAdmin(java.lang.String playerIP)
onRemoveAdmin
in interface GUIListener
playerIP
- the IP address of the playerpublic void onSetTeam(int playerNumber, int teamNumber)
onSetTeam
in interface GUIListener
playerNumber
- the unique in-game ID number of the playerteamNumber
- the ID of the team to assign the player to, where
1 = alpha, 2 = beta, 3 = charlie and 4 = deltapublic void onScriptButtonClick(java.lang.String name, java.lang.String scriptFile)
onScriptButtonClick
in interface GUIListener
name
- the name/caption of the buttonscriptFile
- the script file associated with the buttonpublic void onConnected()
Connection
object.
onConnected
in interface ConnectionListener
public void onDisconnected()
onDisconnected
in interface ConnectionListener
public void onError(java.lang.String message)
onError
in interface ConnectionListener
message
- the error messagepublic static java.lang.String formatTime(int seconds)
seconds
- the time to translate, in secondpublic void dispatchScript(java.lang.String scriptFile)
scriptFile
- the path of the script file to executepublic java.lang.String getCurrentMap()
getCurrentMap
in interface ScriptingFacade
String
containing the name of the current mappublic java.lang.String getGameType()
getGameType
in interface ScriptingFacade
String
containing the name of the current game typepublic int getTimeLimit()
getTimeLimit
in interface ScriptingFacade
public int getTimeLeft()
getTimeLeft
in interface ScriptingFacade
public int getScoreLimit()
getScoreLimit
in interface ScriptingFacade
public int getNumPlayers()
getNumPlayers
in interface ScriptingFacade
public void setWindowTitle(java.lang.String title)
setWindowTitle
in interface ScriptingFacade
title
- the new title for the windowpublic java.lang.String getWindowTitle()
getWindowTitle
in interface ScriptingFacade
String
containing the title of the main windowpublic java.lang.String getIPField()
getIPField
in interface ScriptingFacade
String
containing the value of the IP fieldpublic java.lang.String getPortField()
getPortField
in interface ScriptingFacade
String
containing the value of the port fieldpublic java.lang.String getPasswordField()
getPasswordField
in interface ScriptingFacade
public java.lang.String getCommandBox()
getCommandBox
in interface ScriptingFacade
String
containing the value of the command combo boxpublic void setIPField(java.lang.String ip)
setIPField
in interface ScriptingFacade
ip
- the new IP address valuepublic void setPortField(java.lang.String port)
setPortField
in interface ScriptingFacade
port
- the new port valuepublic void setPasswordField(java.lang.String password)
setPasswordField
in interface ScriptingFacade
password
- the new password valuepublic void setCommandBox(java.lang.String command)
setCommandBox
in interface ScriptingFacade
command
- the new value to set the command combo box topublic void clearConsole()
clearConsole
in interface ScriptingFacade
public void disconnectClient()
disconnectClient
in interface ScriptingFacade
public void connectClient(java.lang.String ip, int port)
connectClient
in interface ScriptingFacade
ip
- the IP address of the serverport
- the port number of the serverpublic void connectClient()
connectClient
in interface ScriptingFacade
public void writeToConsole(java.lang.String text)
writeToConsole
in interface ScriptingFacade
text
- the text to print on the consolepublic void sendData(java.lang.String data)
sendData
in interface ScriptingFacade
data
- the data to sendpublic java.lang.String[] getPlayerData(java.lang.String playerName)
getPlayerData
in interface ScriptingFacade
playerName
- the name of the player to match
public java.lang.String[][] getPlayerData()
getPlayerData
in interface ScriptingFacade
String
objects containing the data in the
tablepublic java.lang.String[] getTeamData(java.lang.String teamName)
getTeamData
in interface ScriptingFacade
teamName
- the name of the team to match
public java.lang.String[][] getTeamData()
getTeamData
in interface ScriptingFacade
String
objects containing the data in the
table
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |