public final class SubDataServer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
SubDataServer.Encryption |
Constructor and Description |
---|
SubDataServer(SubPlugin plugin,
int port,
int backlog,
java.net.InetAddress address,
SubDataServer.Encryption encryption)
SubData Server Instance
|
Modifier and Type | Method and Description |
---|---|
Client |
addClient(java.net.Socket socket)
Add a Client to the Network
|
static void |
allowConnection(java.net.InetAddress 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.net.InetAddress address)
Deny Connections from an Address
|
void |
destroy()
Drops All Connections and Stops the SubData Listener
|
Client |
getClient(java.net.InetSocketAddress address)
Grabs a Client from the Network
|
Client |
getClient(java.net.Socket socket)
Grabs a Client from the Network
|
java.util.Collection<Client> |
getClients()
Grabs all the Clients on the Network
|
SubDataServer.Encryption |
getEncryption()
Gets the Server's Encryption method
|
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
|
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 SubDataServer(SubPlugin plugin, int port, int backlog, java.net.InetAddress address, SubDataServer.Encryption encryption) throws java.io.IOException
plugin
- SubPluginport
- Portbacklog
- Connection Queueaddress
- Bind Addressjava.io.IOException
public java.net.ServerSocket getServer()
public SubDataServer.Encryption getEncryption()
public 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 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 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.net.InetAddress address)
address
- Address to allowpublic static void denyConnection(java.net.InetAddress address)
address
- Address to denypublic void destroy() throws java.io.IOException
java.io.IOException