net.ME1312.SubServers.Bungee.Network

## Class SubDataServer

- java.lang.Object
- - net.ME1312.SubServers.Bungee.Network.SubDataServer

    public final class SubDataServer
    extends java.lang.Object

SubDataServer Class

Author:
  ME1312

### Constructor Summary

Constructors
Constructor and Description
`SubDataServer(SubPlugin plugin, int port, int backlog, java.net.InetAddress address)` SubData Server Instance

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`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
`static PacketIn` `getPacket(java.lang.String handle)` Grab PacketIn Instance 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

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### SubDataServer

    public SubDataServer(SubPlugin plugin,
                         int port,
                         int backlog,
                         java.net.InetAddress address)
                  throws java.io.IOException

SubData Server Instance

Parameters:
  `plugin` - SubPlugin
  `port` - Port
  `backlog` - Connection Queue
  `address` - Bind Address
Throws:
  `java.io.IOException`

### Method Detail

#### getServer

    public java.net.ServerSocket getServer()

Gets the Server Socket

Returns:
  Server Socket

#### addClient

    public Client addClient(java.net.Socket socket)
                     throws java.io.IOException

Add a Client to the Network

Parameters:
  `socket` - Client to add
Throws:
  `java.io.IOException`

#### getClient

    public Client getClient(java.net.Socket socket)

Grabs a Client from the Network

Parameters:
  `socket` - Socket to search
Returns:
  Client

#### getClient

    public Client getClient(java.net.InetSocketAddress address)

Grabs a Client from the Network

Parameters:
  `address` - Address to search
Returns:
  Client

#### removeClient

    public void removeClient(Client client)
                      throws java.io.IOException

Remove a Client from the Network

Parameters:
  `client` - Client to Kick
Throws:
  `java.io.IOException`

#### removeClient

    public void removeClient(java.net.InetSocketAddress address)
                      throws java.io.IOException

Remove a Client from the Network

Parameters:
  `address` - Address to Kick
Throws:
  `java.io.IOException`

#### registerPacket

    public static void registerPacket(PacketIn packet,
                                      java.lang.String handle)

Register PacketIn to the Network

Parameters:
  `packet` - PacketIn to register
  `handle` - Handle to Bind

#### registerPacket

    public static void registerPacket(java.lang.Class<? extends PacketOut> packet,
                                      java.lang.String handle)

Register PacketOut to the Network

Parameters:
  `packet` - PacketOut to register
  `handle` - Handle to bind

#### getPacket

    public static PacketIn getPacket(java.lang.String handle)

Grab PacketIn Instance via handle

Parameters:
  `handle` - Handle
Returns:
  PacketIn

#### broadcastPacket

    public 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

Parameters:
  `packet` - Packet to send

#### allowConnection

    public static void allowConnection(java.net.InetAddress address)

Allow Connections from an Address

Parameters:
  `address` - Address to allow

#### denyConnection

    public static void denyConnection(java.net.InetAddress address)

Deny Connections from an Address

Parameters:
  `address` - Address to deny

#### destroy

    public void destroy()
                 throws java.io.IOException

Drops All Connections and Stops the SubData Listener

Throws:
  `java.io.IOException`