mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-14 18:05:51 -04:00
network: rename getCommand methods
This commit is contained in:
parent
a8fcc8efe1
commit
7101fd04f3
@ -20,6 +20,6 @@ import de.bixilon.minosoft.protocol.protocol.Packets;
|
|||||||
public class PacketNotImplementedException extends PacketParseException {
|
public class PacketNotImplementedException extends PacketParseException {
|
||||||
|
|
||||||
public PacketNotImplementedException(InPacketBuffer buffer, Packets.Clientbound packetType, Connection connection) {
|
public PacketNotImplementedException(InPacketBuffer buffer, Packets.Clientbound packetType, Connection connection) {
|
||||||
super(String.format("Packet not implemented yet (id=0x%x, name=%s, length=%d, dataLength=%d, version=%s, state=%s)", buffer.getCommand(), packetType, buffer.getLength(), buffer.getBytesLeft(), connection.getVersion(), connection.getConnectionState()));
|
super(String.format("Packet not implemented yet (id=0x%x, name=%s, length=%d, dataLength=%d, version=%s, state=%s)", buffer.getPacketTypeId(), packetType, buffer.getLength(), buffer.getBytesLeft(), connection.getVersion(), connection.getConnectionState()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,9 +65,9 @@ public abstract class Network {
|
|||||||
Packets.Clientbound packetType = null;
|
Packets.Clientbound packetType = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
packetType = this.connection.getPacketByCommand(this.connection.getConnectionState(), data.getCommand());
|
packetType = this.connection.getPacketByCommand(this.connection.getConnectionState(), data.getPacketTypeId());
|
||||||
if (packetType == null) {
|
if (packetType == null) {
|
||||||
throw new UnknownPacketException(String.format("Server sent us an unknown packet (id=0x%x, length=%d, data=%s)", data.getCommand(), bytes.length, data.getBase64()));
|
throw new UnknownPacketException(String.format("Server sent us an unknown packet (id=0x%x, length=%d, data=%s)", data.getPacketTypeId(), bytes.length, data.getBase64()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientboundPacket packet;
|
ClientboundPacket packet;
|
||||||
|
@ -23,7 +23,7 @@ public class InPacketBuffer extends InByteBuffer {
|
|||||||
this.command = readVarInt();
|
this.command = readVarInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCommand() {
|
public int getPacketTypeId() {
|
||||||
return this.command;
|
return this.command;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,19 +18,19 @@ import de.bixilon.minosoft.protocol.network.Connection;
|
|||||||
public class OutPacketBuffer extends OutByteBuffer {
|
public class OutPacketBuffer extends OutByteBuffer {
|
||||||
private final int command;
|
private final int command;
|
||||||
|
|
||||||
public OutPacketBuffer(Connection connection, Packets.Serverbound command) {
|
public OutPacketBuffer(Connection connection, Packets.Serverbound packetType) {
|
||||||
super(connection);
|
super(connection);
|
||||||
this.command = connection.getPacketCommand(command);
|
this.command = connection.getPacketCommand(packetType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] toByteArray() {
|
public byte[] toByteArray() {
|
||||||
OutByteBuffer ret = new OutByteBuffer(this);
|
OutByteBuffer ret = new OutByteBuffer(this);
|
||||||
ret.prefixVarInt(getCommand());
|
ret.prefixVarInt(getPacketTypeId());
|
||||||
return ret.toByteArray();
|
return ret.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCommand() {
|
public int getPacketTypeId() {
|
||||||
return this.command;
|
return this.command;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user