public final class SubDataServer
extends java.lang.Object
Constructor and Description |
---|
SubDataServer(SubPlugin plugin,
int port,
java.net.InetAddress address,
Cipher cipher)
SubData Server Instance
|
Modifier and Type | Method and Description |
---|---|
static void |
addCipher(java.lang.String handle,
Cipher cipher)
Add a Cipher for use by SubData
|
Client |
addClient(java.net.Socket socket)
Add a Client to the Network
|
static void |
allowConnection(java.lang.String address)
Allow Connections from an Address
|
void |
broadcastPacket(PacketOut packet)
Broadcast a Packet to everything on the Network
Warning: There are usually different types of applications on the network at once, they may not recognise the same packet handles |
static void |
denyConnection(java.lang.String address)
Deny Connections from an Address
|
void |
destroy()
Drops All Connections and Stops the SubData Listener
|
Cipher |
getCipher()
Gets the Server's Cipher
|
static Cipher |
getCipher(java.lang.String handle)
Gets a Cipher by Handle
|
static java.util.Map<java.lang.String,Cipher> |
getCiphers()
Gets the Ciphers
|
Client |
getClient(java.net.InetSocketAddress address)
Grabs a Client from the Network
|
Client |
getClient(java.net.Socket socket)
Grabs a Client from the Network
|
Client |
getClient(java.lang.String address)
Grabs a Client from the Network
|
java.util.Collection<Client> |
getClients()
Grabs all the Clients on the Network
|
static java.util.List<? extends PacketIn> |
getPacket(java.lang.String handle)
Grab PacketIn Instances via handle
|
java.net.ServerSocket |
getServer()
Gets the Server Socket
|
static void |
registerPacket(java.lang.Class<? extends PacketOut> packet,
java.lang.String handle)
Register PacketOut to the Network
|
static void |
registerPacket(PacketIn packet,
java.lang.String handle)
Register PacketIn to the Network
|
void |
removeClient(Client client)
Remove a Client from the Network
|
void |
removeClient(java.net.InetSocketAddress address)
Remove a Client from the Network
|
void |
removeClient(java.lang.String address)
Remove a Client from the Network
|
static void |
unregisterPacket(java.lang.Class<? extends PacketOut> packet)
Unregister PacketOut to the Network
|
static void |
unregisterPacket(PacketIn packet)
Unregister PacketIn from the Network
|
public java.net.ServerSocket getServer()
public static void addCipher(java.lang.String handle, Cipher cipher)
cipher
- Cipher to Addhandle
- Handle to Bindpublic static java.util.Map<java.lang.String,Cipher> getCiphers()
public Cipher getCipher()
public static Cipher getCipher(java.lang.String handle)
handle
- Handlepublic Client addClient(java.net.Socket socket) throws java.io.IOException
socket
- Client to addjava.io.IOException
public Client getClient(java.net.Socket socket)
socket
- Socket to searchpublic Client getClient(java.net.InetSocketAddress address)
address
- Address to searchpublic Client getClient(java.lang.String address)
address
- Address to searchpublic java.util.Collection<Client> getClients()
public void removeClient(Client client) throws java.io.IOException
client
- Client to Kickjava.io.IOException
public void removeClient(java.net.InetSocketAddress address) throws java.io.IOException
address
- Address to Kickjava.io.IOException
public void removeClient(java.lang.String address) throws java.io.IOException
address
- Address to Kickjava.io.IOException
public static void registerPacket(PacketIn packet, java.lang.String handle)
packet
- PacketIn to registerhandle
- Handle to Bindpublic static void unregisterPacket(PacketIn packet)
packet
- PacketIn to unregisterpublic static void registerPacket(java.lang.Class<? extends PacketOut> packet, java.lang.String handle)
packet
- PacketOut to registerhandle
- Handle to bindpublic static void unregisterPacket(java.lang.Class<? extends PacketOut> packet)
packet
- PacketOut to unregisterpublic static java.util.List<? extends PacketIn> getPacket(java.lang.String handle)
handle
- Handlepublic void broadcastPacket(PacketOut packet)
packet
- Packet to sendpublic static void allowConnection(java.lang.String address)
address
- Address to allowpublic static void denyConnection(java.lang.String address)
address
- Address to denypublic void destroy() throws java.io.IOException
java.io.IOException