mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-12 08:58:02 -04:00
log packet to packet handling thread
This commit is contained in:
parent
841d3bc624
commit
00fc8ec051
@ -123,6 +123,7 @@ public class Connection {
|
||||
Thread handleThread = new Thread(() -> {
|
||||
while (getConnectionState() != ConnectionState.DISCONNECTED) {
|
||||
while (handlingQueue.size() > 0) {
|
||||
handlingQueue.get(0).log();
|
||||
handlingQueue.get(0).handle(getHandler());
|
||||
handlingQueue.remove(0);
|
||||
}
|
||||
|
@ -20,8 +20,6 @@ public class PacketEncryptionKeyRequest implements ClientboundPacket {
|
||||
verifyToken = buffer.readBytes(buffer.readShort()); // read length, then the bytes
|
||||
break;
|
||||
} // ToDo
|
||||
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -13,7 +13,6 @@ public class PacketLoginDisconnect implements ClientboundPacket {
|
||||
@Override
|
||||
public void read(InPacketBuffer buffer, ProtocolVersion v) {
|
||||
reason = buffer.readChatComponent();
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,8 +16,6 @@ public class PacketLoginSuccess implements ClientboundPacket {
|
||||
public void read(InPacketBuffer buffer, ProtocolVersion v) {
|
||||
uuid = UUID.fromString(buffer.readString());
|
||||
username = buffer.readString();
|
||||
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,7 +19,6 @@ public class PacketChangeGameState implements ClientboundPacket {
|
||||
value = buffer.readFloat();
|
||||
break;
|
||||
}
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,7 +18,6 @@ public class PacketChatMessage implements ClientboundPacket {
|
||||
c = buffer.readChatComponent();
|
||||
break;
|
||||
}
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -103,7 +103,6 @@ public class PacketChunkBulk implements ClientboundPacket {
|
||||
}
|
||||
break;
|
||||
}
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,7 +18,6 @@ public class PacketDisconnect implements ClientboundPacket {
|
||||
reason = buffer.readChatComponent();
|
||||
break;
|
||||
}
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +16,6 @@ public class PacketHeldItemChangeReceiving implements ClientboundPacket {
|
||||
slot = buffer.readByte();
|
||||
break;
|
||||
}
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,7 +38,6 @@ public class PacketJoinGame implements ClientboundPacket {
|
||||
levelType = LevelType.byType(buffer.readString());
|
||||
break;
|
||||
}
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,7 +17,6 @@ public class PacketKeepAlive implements ClientboundPacket {
|
||||
id = buffer.readInteger();
|
||||
break;
|
||||
}
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,7 +22,6 @@ public class PacketPlayerInfo implements ClientboundPacket {
|
||||
|
||||
break;
|
||||
}
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,7 +19,6 @@ public class PacketPluginMessageReceiving implements ClientboundPacket {
|
||||
data = buffer.readBytes(buffer.readShort()); // first read length, then the data
|
||||
break;
|
||||
}
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,7 +22,6 @@ public class PacketSetExperience implements ClientboundPacket {
|
||||
total = buffer.readShort();
|
||||
break;
|
||||
}
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,7 +21,6 @@ public class PacketSpawnLocation implements ClientboundPacket {
|
||||
loc = new Location(x, y, z);
|
||||
break;
|
||||
}
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,7 +19,6 @@ public class PacketTimeUpdate implements ClientboundPacket {
|
||||
timeOfDay = buffer.readLong();
|
||||
break;
|
||||
}
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,7 +21,6 @@ public class PacketUpdateHealth implements ClientboundPacket {
|
||||
saturation = (float) (Math.round(buffer.readFloat() * 10) / 10.0);
|
||||
break;
|
||||
}
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,7 +12,6 @@ public class PacketStatusPong implements ClientboundPacket {
|
||||
@Override
|
||||
public void read(InPacketBuffer buffer, ProtocolVersion v) {
|
||||
this.id = buffer.readLong();
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,7 +14,6 @@ public class PacketStatusResponse implements ClientboundPacket {
|
||||
public void read(InPacketBuffer buffer, ProtocolVersion v) {
|
||||
// no version checking, is the same in all versions (1.7.x - 1.15.2)
|
||||
response = new ServerListPing(buffer.readJson());
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,6 +16,7 @@ public class PacketHandshake implements ServerboundPacket {
|
||||
this.port = port;
|
||||
this.nextState = nextState;
|
||||
this.version = version;
|
||||
log();
|
||||
}
|
||||
|
||||
public PacketHandshake(String address, int version) {
|
||||
@ -23,11 +24,11 @@ public class PacketHandshake implements ServerboundPacket {
|
||||
this.version = version;
|
||||
this.port = ProtocolDefinition.DEFAULT_PORT;
|
||||
this.nextState = ConnectionState.STATUS;
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
public OutPacketBuffer write(ProtocolVersion v) {
|
||||
log();
|
||||
// no version checking, is the same in all versions (1.7.x - 1.15.2)
|
||||
OutPacketBuffer buffer = new OutPacketBuffer(v.getPacketCommand(Packets.Serverbound.STATUS_REQUEST));
|
||||
buffer.writeVarInt((nextState == ConnectionState.STATUS ? -1 : version)); // get best protocol version
|
||||
|
@ -21,6 +21,7 @@ public class PacketEncryptionResponse implements ServerboundPacket {
|
||||
this.secretKey = secret;
|
||||
this.secret = CryptManager.encryptData(key, secret.getEncoded());
|
||||
this.token = CryptManager.encryptData(key, token);
|
||||
log();
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +31,6 @@ public class PacketEncryptionResponse implements ServerboundPacket {
|
||||
|
||||
@Override
|
||||
public OutPacketBuffer write(ProtocolVersion v) {
|
||||
log();
|
||||
OutPacketBuffer buffer = new OutPacketBuffer(v.getPacketCommand(Packets.Serverbound.LOGIN_ENCRYPTION_RESPONSE));
|
||||
switch (v) {
|
||||
case VERSION_1_7_10:
|
||||
|
@ -13,15 +13,16 @@ public class PacketLoginStart implements ServerboundPacket {
|
||||
|
||||
public PacketLoginStart(Player p) {
|
||||
username = p.getPlayerName();
|
||||
log();
|
||||
}
|
||||
|
||||
public PacketLoginStart(String username) {
|
||||
this.username = username;
|
||||
log();
|
||||
}
|
||||
|
||||
@Override
|
||||
public OutPacketBuffer write(ProtocolVersion v) {
|
||||
log();
|
||||
// no version checking, is the same in all versions (1.7.x - 1.15.2)
|
||||
OutPacketBuffer buffer = new OutPacketBuffer(v.getPacketCommand(Packets.Serverbound.LOGIN_LOGIN_START));
|
||||
buffer.writeString((username == null) ? "Player132" : username);
|
||||
|
@ -16,12 +16,12 @@ public class PacketClientSettings implements ServerboundPacket {
|
||||
public PacketClientSettings(Locale locale, int renderDistance) {
|
||||
this.locale = locale;
|
||||
this.renderDistance = (byte) renderDistance;
|
||||
log();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public OutPacketBuffer write(ProtocolVersion v) {
|
||||
log();
|
||||
OutPacketBuffer buffer = new OutPacketBuffer(v.getPacketCommand(Packets.Serverbound.PLAY_CLIENT_SETTINGS));
|
||||
switch (v) {
|
||||
case VERSION_1_7_10:
|
||||
|
@ -12,16 +12,17 @@ public class PacketHeldItemChangeSending implements ServerboundPacket {
|
||||
|
||||
public PacketHeldItemChangeSending(byte slot) {
|
||||
this.slot = slot;
|
||||
log();
|
||||
}
|
||||
|
||||
public PacketHeldItemChangeSending(int slot) {
|
||||
this.slot = (byte) slot;
|
||||
log();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public OutPacketBuffer write(ProtocolVersion v) {
|
||||
log();
|
||||
OutPacketBuffer buffer = new OutPacketBuffer(v.getPacketCommand(Packets.Serverbound.PLAY_HELD_ITEM_CHANGE));
|
||||
switch (v) {
|
||||
case VERSION_1_7_10:
|
||||
|
@ -12,12 +12,12 @@ public class PacketKeepAliveResponse implements ServerboundPacket {
|
||||
|
||||
public PacketKeepAliveResponse(int id) {
|
||||
this.id = id;
|
||||
log();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public OutPacketBuffer write(ProtocolVersion v) {
|
||||
log();
|
||||
OutPacketBuffer buffer = new OutPacketBuffer(v.getPacketCommand(Packets.Serverbound.LOGIN_LOGIN_START));
|
||||
switch (v) {
|
||||
case VERSION_1_7_10:
|
||||
|
@ -14,17 +14,18 @@ public class PacketPluginMessageSending implements ServerboundPacket {
|
||||
public PacketPluginMessageSending(String channel, byte[] data) {
|
||||
this.channel = channel;
|
||||
this.data = data;
|
||||
log();
|
||||
}
|
||||
|
||||
public PacketPluginMessageSending(String channel, String data) {
|
||||
this.channel = channel;
|
||||
this.data = data.getBytes();
|
||||
log();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public OutPacketBuffer write(ProtocolVersion v) {
|
||||
log();
|
||||
OutPacketBuffer buffer = new OutPacketBuffer(v.getPacketCommand(Packets.Serverbound.PLAY_PLUGIN_MESSAGE));
|
||||
switch (v) {
|
||||
case VERSION_1_7_10:
|
||||
|
Loading…
x
Reference in New Issue
Block a user