net.barkerjr.gameserver.valve
Class GoldSourceServer

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.GoldSourceServer
All Implemented Interfaces:
Closeable

public class GoldSourceServer
extends ValveServer

Provides parsing and Gold-Source-specific server query handling. Gold Source is the Half-Life 1 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
GoldSourceServer(InetAddress ip)
          Deprecated. since 2007-11-10, use GoldSourceServer(InetSocketAddress)
GoldSourceServer(InetAddress ip, int port)
          Deprecated. since 2007-11-10, use GoldSourceServer(InetSocketAddress)
GoldSourceServer(InetSocketAddress address)
          Creates a server for the Valve Gold Source engine
 
Method Summary
static GoldSourceServer getInstance(InetSocketAddress address)
          Gets or creates an instance of the server at the given address.
protected  void loadChallenge()
          Workaround for broken A2S_SERVERQUERY_GETCHALLENGE Requests (Asynchronously) the challenge code from the server
protected  SequenceDvo parsePacketNumber(ReplyStream buffer)
          Parses the next byte for the packet sequence numbers.
 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, 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

GoldSourceServer

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

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

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

GoldSourceServer

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

Creates a server for the Valve Gold Source engine

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

GoldSourceServer

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

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

getInstance

public static GoldSourceServer 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 byte 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:
Rcon.send(int, String, int, String, String)

loadChallenge

protected void loadChallenge()
                      throws IOException
Workaround for broken A2S_SERVERQUERY_GETCHALLENGE Requests (Asynchronously) the challenge code from the server

Overrides:
loadChallenge in class ValveServer
Throws:
IOException - if there was an error sending the request
Since:
2008-11-26
See Also:
Problem