net.barkerjr.gameserver.valve
Class SourceServer

java.lang.Object
  extended by net.barkerjr.gameserver.Base
      extended by net.barkerjr.gameserver.GameServer
          extended by net.barkerjr.gameserver.UdpServer
              extended by net.barkerjr.gameserver.valve.ValveServer
                  extended by net.barkerjr.gameserver.valve.SourceServer
All Implemented Interfaces:
Closeable
Direct Known Subclasses:
OrangeBoxServer

public class SourceServer
extends ValveServer

Provides parsing and Source-specific server query handling. Source is the Half-Life 2 engine.

Since:
2007-10-25
Author:
BarkerJr
See Also:
Specification

Nested Class Summary
 
Nested classes/interfaces inherited from class net.barkerjr.gameserver.valve.ValveServer
ValveServer.OperatingSystem
 
Nested classes/interfaces inherited from class net.barkerjr.gameserver.GameServer
GameServer.Dedicated, GameServer.Request, GameServer.RequestTimeoutException
 
Field Summary
 
Fields inherited from class net.barkerjr.gameserver.valve.ValveServer
rconPassword
 
Fields inherited from class net.barkerjr.gameserver.UdpServer
servers
 
Fields inherited from class net.barkerjr.gameserver.GameServer
address, botCount, dedicated, gameDirectory, IPTOS_RELIABILITY, map, maximumPlayers, name, namespace, numberOfPlayers, passwordRequired, players, plugins, rules, updated, version
 
Fields inherited from class net.barkerjr.gameserver.Base
listeners
 
Constructor Summary
SourceServer(InetAddress ip)
          Deprecated. since 2007-11-10, use SourceServer(InetSocketAddress)
SourceServer(InetAddress ip, int port)
          Deprecated. since 2007-11-10, use SourceServer(InetSocketAddress)
SourceServer(InetSocketAddress address)
          Creates a server for the Valve Source engine
 
Method Summary
static SourceServer getInstance(InetSocketAddress address)
          Gets or creates an instance of the server at the given address.
protected  SequenceDvo parsePacketNumber(ReplyStream buffer)
          Parses the next two bytes for the packet sequence numbers Determines which packet in the multi-packet response this is
 String sendRcon(String command)
          Sends the given command to the server and waits for a reply.
 
Methods inherited from class net.barkerjr.gameserver.valve.ValveServer
getApplicationId, getGameDescription, getOperatingSystem, getShip, handleMessage, handlePlayers, isVacSecure, load, loadChallenge, loadInformation, loadPlayers, loadRules, parseData, sendRcon, setRconPassword, toJsonObject
 
Methods inherited from class net.barkerjr.gameserver.UdpServer
close, sendData, sendData
 
Methods inherited from class net.barkerjr.gameserver.GameServer
addPlugin, equals, fireChangeEvent, fireLoadEvent, getBotCount, getDedicated, getGameDirectory, getIP, getMap, getMaximumPlayers, getName, getNumberOfPlayers, getPlayers, getPlugins, getPort, getRules, getUpdated, getVersion, handleError, hashCode, isPasswordRequired, load, replaceChild, toString, toXmlDocument
 
Methods inherited from class net.barkerjr.gameserver.Base
addListener, removeListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SourceServer

@Deprecated
public SourceServer(InetAddress ip)
Deprecated. since 2007-11-10, use SourceServer(InetSocketAddress)

Creates a server for the Valve Source engine, defaulting to port 27015

Parameters:
ip - the IP address of the server
Since:
2007-10-25

SourceServer

@Deprecated
public SourceServer(InetAddress ip,
                               int port)
Deprecated. since 2007-11-10, use SourceServer(InetSocketAddress)

Creates a server for the Valve Source engine

Parameters:
ip - the IP address of the server
port - the port of the server
Since:
2007-10-25

SourceServer

public SourceServer(InetSocketAddress address)
Creates a server for the Valve Source engine

Parameters:
address - the address of the server
Since:
2007-11-10
Method Detail

getInstance

public static SourceServer getInstance(InetSocketAddress address)
Gets or creates an instance of the server at the given address.

Parameters:
address - the address of the server
Returns:
the server
Since:
2007-11-18

parsePacketNumber

protected SequenceDvo parsePacketNumber(ReplyStream buffer)
Parses the next two bytes for the packet sequence numbers Determines which packet in the multi-packet response this is

Specified by:
parsePacketNumber in class ValveServer
Parameters:
buffer - the packet data
Returns:
a DVO containing this packet's sequence number, and the total number of packets to expect
Since:
2007-10-25

sendRcon

public String sendRcon(String command)
                throws FailedLoginException,
                       SocketTimeoutException
Description copied from class: ValveServer
Sends the given command to the server and waits for a reply.

Specified by:
sendRcon in class ValveServer
Parameters:
command - the command to send
Returns:
the response from the server
Throws:
FailedLoginException - if the password set by ValveServer.setRconPassword(String) is bad
SocketTimeoutException - if there was an error contacting the server
Since:
2008-02-03
See Also:
SourceRcon.send(String, int, String, String)