Add 'unsafe' api for things like packet sending that may be implementation specific or break at any time

This commit is contained in:
md_5
2013-05-31 17:02:45 +10:00
parent 9fd69068ae
commit 639e5f3c1d
10 changed files with 93 additions and 32 deletions

View File

@@ -37,6 +37,12 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-protocol</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>

View File

@@ -1,6 +1,7 @@
package net.md_5.bungee.api.connection;
import java.net.InetSocketAddress;
import net.md_5.bungee.protocol.packet.DefinedPacket;
/**
* A proxy connection is defined as a connection directly connected to a socket.
@@ -15,7 +16,7 @@ public interface Connection
*
* @return the remote address
*/
public InetSocketAddress getAddress();
InetSocketAddress getAddress();
/**
* Disconnects this end of the connection for the specified reason. If this
@@ -25,5 +26,23 @@ public interface Connection
* @param reason the reason shown to the player / sent to the server on
* disconnect
*/
public void disconnect(String reason);
void disconnect(String reason);
/**
* Get the unsafe methods of this class.
*
* @return the unsafe method interface
*/
Unsafe unsafe();
interface Unsafe
{
/**
* Send a packet to this connection.
*
* @param packet the packet to send
*/
void sendPacket(DefinedPacket packet);
}
}