com.drdanick.McRKit.api
Class RTKInterface

java.lang.Object
  extended by com.drdanick.McRKit.api.RTKInterface

public class RTKInterface
extends java.lang.Object

The RTKInterface handles all of the UDP API calls to the RemoteToolkit Minecraft wrapper.


Nested Class Summary
static class RTKInterface.CommandType
          Defines the type of action to perform.
 
Constructor Summary
RTKInterface(int port, java.lang.String host, java.lang.String user, java.lang.String password, java.lang.String salt)
          Instantiates an RTKInterface.
 
Method Summary
 void executeCommand(RTKInterface.CommandType type, java.lang.String commandParameter)
          Executes an API function.
 java.lang.String getLastResponse()
          Get the last response that was received from the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RTKInterface

public RTKInterface(int port,
                    java.lang.String host,
                    java.lang.String user,
                    java.lang.String password,
                    java.lang.String salt)
Instantiates an RTKInterface.

Parameters:
port - The port to send API events to.
host - The host name to send API events to.
user - The wrapper username to send API calls as.
password - The wrapper password that is tied to username.
salt - the String to salt the password with.
Method Detail

getLastResponse

public java.lang.String getLastResponse()
                                 throws java.lang.InterruptedException
Get the last response that was received from the server.

If no response has been received from the server since the current request was made, this method will block until either a response is recorded, or the request times out.

Throws:
java.lang.InterruptedException - if the underlying wait() call is interrupted.

executeCommand

public void executeCommand(RTKInterface.CommandType type,
                           java.lang.String commandParameter)
                    throws java.io.IOException,
                           RTKInterfaceException
Executes an API function.

Parameters:
type - The type of wrapper function to perform.
commandParameter - used to specify extra parameters used by some CommandTypes.
Throws:
java.io.IOException - If an IOException occurs when making the request.
RTKInterfaceException - if the command is invalid.