mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-12-26 10:37:46 +01:00
Fill out all handlers for packets just in case they are needed.
This commit is contained in:
parent
23582a635b
commit
b946e376c7
@ -109,10 +109,7 @@ public abstract class DefinedPacket implements DataInput, DataOutput
|
|||||||
@Override
|
@Override
|
||||||
public abstract String toString();
|
public abstract String toString();
|
||||||
|
|
||||||
public void handle(PacketHandler handler) throws Exception
|
public abstract void handle(PacketHandler handler) throws Exception;
|
||||||
{
|
|
||||||
handler.handle( this );
|
|
||||||
}
|
|
||||||
private static Class<? extends DefinedPacket>[] classes = new Class[ 256 ];
|
private static Class<? extends DefinedPacket>[] classes = new Class[ 256 ];
|
||||||
|
|
||||||
public static DefinedPacket packet(byte[] buf)
|
public static DefinedPacket packet(byte[] buf)
|
||||||
|
@ -15,4 +15,10 @@ public class Packet0KeepAlive extends DefinedPacket
|
|||||||
super( 0x00, buffer );
|
super( 0x00, buffer );
|
||||||
id = readInt();
|
id = readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(PacketHandler handler) throws Exception
|
||||||
|
{
|
||||||
|
handler.handle( this );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,4 +21,10 @@ public class Packet3Chat extends DefinedPacket
|
|||||||
super( 0x03, buf );
|
super( 0x03, buf );
|
||||||
this.message = readUTF();
|
this.message = readUTF();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(PacketHandler handler) throws Exception
|
||||||
|
{
|
||||||
|
handler.handle( this );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,4 +33,10 @@ public class Packet9Respawn extends DefinedPacket
|
|||||||
this.worldHeight = readShort();
|
this.worldHeight = readShort();
|
||||||
this.levelType = readUTF();
|
this.levelType = readUTF();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(PacketHandler handler) throws Exception
|
||||||
|
{
|
||||||
|
handler.handle( this );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,4 +27,10 @@ public class PacketC9PlayerListItem extends DefinedPacket
|
|||||||
writeBoolean( online );
|
writeBoolean( online );
|
||||||
writeShort( ping );
|
writeShort( ping );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(PacketHandler handler) throws Exception
|
||||||
|
{
|
||||||
|
handler.handle( this );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,4 +21,10 @@ public class PacketFFKick extends DefinedPacket
|
|||||||
super( 0xFF, buf );
|
super( 0xFF, buf );
|
||||||
this.message = readUTF();
|
this.message = readUTF();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(PacketHandler handler) throws Exception
|
||||||
|
{
|
||||||
|
handler.handle( this );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,36 +3,68 @@ package net.md_5.bungee.packet;
|
|||||||
public abstract class PacketHandler
|
public abstract class PacketHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
public void handle(DefinedPacket packet) throws Exception
|
private void nop(DefinedPacket packet)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException( "No handler defined for packet " + packet.getClass() );
|
throw new UnsupportedOperationException( "No handler defined for packet " + packet.getClass() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void handle(Packet0KeepAlive alive) throws Exception
|
||||||
|
{
|
||||||
|
nop( alive );
|
||||||
|
}
|
||||||
|
|
||||||
public void handle(Packet1Login login) throws Exception
|
public void handle(Packet1Login login) throws Exception
|
||||||
{
|
{
|
||||||
|
nop( login );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handle(Packet2Handshake handshake) throws Exception
|
public void handle(Packet2Handshake handshake) throws Exception
|
||||||
{
|
{
|
||||||
|
nop( handshake );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handle(Packet3Chat chat) throws Exception
|
||||||
|
{
|
||||||
|
nop( chat );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handle(Packet9Respawn respawn) throws Exception
|
||||||
|
{
|
||||||
|
nop( respawn );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handle(PacketC9PlayerListItem playerList) throws Exception
|
||||||
|
{
|
||||||
|
nop( playerList );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handle(PacketCDClientStatus clientStatus) throws Exception
|
public void handle(PacketCDClientStatus clientStatus) throws Exception
|
||||||
{
|
{
|
||||||
|
nop( clientStatus );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handle(PacketFAPluginMessage pluginMessage) throws Exception
|
public void handle(PacketFAPluginMessage pluginMessage) throws Exception
|
||||||
{
|
{
|
||||||
|
nop( pluginMessage );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handle(PacketFCEncryptionResponse encryptResponse) throws Exception
|
public void handle(PacketFCEncryptionResponse encryptResponse) throws Exception
|
||||||
{
|
{
|
||||||
|
nop( encryptResponse );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handle(PacketFDEncryptionRequest encryptRequest) throws Exception
|
public void handle(PacketFDEncryptionRequest encryptRequest) throws Exception
|
||||||
{
|
{
|
||||||
|
nop( encryptRequest );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handle(PacketFEPing ping) throws Exception
|
public void handle(PacketFEPing ping) throws Exception
|
||||||
{
|
{
|
||||||
|
nop( ping );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handle(PacketFFKick kick) throws Exception
|
||||||
|
{
|
||||||
|
nop( kick );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
|
||||||
import net.md_5.mendax.datainput.DataInputPacketReader;
|
import net.md_5.mendax.datainput.DataInputPacketReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user