Skip to content

Commit 412bcd8

Browse files
committed
Improve logging for packet handling in LoginQueryParser and ServerLoginNetworkAddon
1 parent 6f38cf0 commit 412bcd8

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

src/main/java/pl/skidam/automodpack/networking/LoginQueryParser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import net.minecraft.network.packet.s2c.login.LoginQueryRequestPayload;
1717
/*?}*/
1818

19+
import static pl.skidam.automodpack_core.GlobalVariables.LOGGER;
20+
1921
public class LoginQueryParser {
2022
public Packet<?> packet;
2123
public boolean success = true;
@@ -30,7 +32,6 @@ public LoginQueryParser(Packet<?> packet) {
3032
/*this.queryId = packetS2C.getQueryId();
3133
this.buf = packetS2C.getPayload();
3234
this.channelName = packetS2C.getChannel();
33-
this.success = true;
3435
*//*?} else {*/
3536
this.queryId = packetS2C.queryId();
3637
LoginQueryRequestPayload payload = packetS2C.payload();
@@ -44,7 +45,6 @@ public LoginQueryParser(Packet<?> packet) {
4445
/*? if <1.20.2 {*/
4546
/*this.queryId = packetC2S.getQueryId();
4647
this.buf = packetC2S.getResponse();
47-
this.success = true;
4848
*//*?} else {*/
4949
this.queryId = packetC2S.queryId();
5050
LoginQueryResponsePayload payload = packetC2S.response();
@@ -55,7 +55,7 @@ public LoginQueryParser(Packet<?> packet) {
5555
/*?}*/
5656
} else {
5757
success = false;
58-
throw new IllegalArgumentException("Invalid packet type " + packet);
58+
LOGGER.error("Invalid packet type: {}", packet.getClass().getName());
5959
}
6060
}
6161
}

src/main/java/pl/skidam/automodpack/networking/server/ServerLoginNetworkAddon.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public boolean queryTick() {
4949
}
5050

5151
this.synchronizers.removeIf(future -> {
52-
5352
if (!future.isDone()) {
5453
return false;
5554
}
@@ -125,7 +124,7 @@ public void sendPacket(LoginQueryRequestS2CPacket packet) {
125124
this.channels.put(loginQuery.queryId, loginQuery.channelName);
126125
this.connection.send(packet);
127126
} else {
128-
LOGGER.error("Failed to send packet: " + packet);
127+
LOGGER.error("Failed to send packet: {}", packet);
129128
}
130129
}
131130
}

0 commit comments

Comments
 (0)