Skip to content

Commit

Permalink
Remove it in future! Compatible with 1.1.x, then we can do something …
Browse files Browse the repository at this point in the history
…like kicking...
  • Loading branch information
boybook committed Oct 31, 2017
1 parent 4c6c078 commit 6e2e256
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/java/cn/nukkit/network/Network.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,15 @@ public void processBatch(BatchPacket packet, Player player) {

if ((pk = this.getPacket(buf[0])) != null) {
pk.setBuffer(buf, 3); //skip 2 more bytes

pk.decode();

try {
pk.decode();
} catch (Exception e) {
//TODO: Remove it in future! Compatible with 1.1.x, then we can do something like kicking...
if (pk.pid() == ProtocolInfo.LOGIN_PACKET) {
pk.setBuffer(buf, 1);
pk.decode();
} else throw e;
}
packets.add(pk);
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/cn/nukkit/network/protocol/LoginPacket.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public byte pid() {
@Override
public void decode() {
this.protocol = this.getInt();
//TODO: Remove it in future! Compatible with 1.1.x, then we can do something like kicking...
if (this.protocol <= 113) this.getByte();
this.setBuffer(this.getByteArray(), 0);
decodeChainData();
decodeSkinData();
Expand Down

1 comment on commit 6e2e256

@Creeperface01
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this branch is already merged. however disconnect packet will be sent in 1.2 format so maybe player won't disconnect

Please sign in to comment.