mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-25 02:17:35 +01:00
Detect and disconnect 1.3 clients properly. Fixes BUKKIT-1952
This commit is contained in:
parent
b00de5f176
commit
a4d7691299
@ -55,6 +55,12 @@ public class NetLoginHandler extends NetHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(Packet2Handshake packet2handshake) {
|
public void a(Packet2Handshake packet2handshake) {
|
||||||
|
// CraftBukkit start - 1.3 detection
|
||||||
|
if (packet2handshake.a == null) {
|
||||||
|
disconnect("Outdated server!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
int i = packet2handshake.a.indexOf(';');
|
int i = packet2handshake.a.indexOf(';');
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
|
@ -52,7 +52,7 @@ public class NetworkManager {
|
|||||||
try {
|
try {
|
||||||
// CraftBukkit start - cant compile these outside the try
|
// CraftBukkit start - cant compile these outside the try
|
||||||
socket.setSoTimeout(30000);
|
socket.setSoTimeout(30000);
|
||||||
this.input = new DataInputStream(socket.getInputStream());
|
this.input = new DataInputStream(new java.io.BufferedInputStream(socket.getInputStream(), 2)); // Remove buffered input after 1.3
|
||||||
this.output = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream(), 5120));
|
this.output = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream(), 5120));
|
||||||
} catch (java.io.IOException socketexception) {
|
} catch (java.io.IOException socketexception) {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -146,6 +146,23 @@ public class NetworkManager {
|
|||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// CraftBukkit start - 1.3 detection
|
||||||
|
this.input.mark(2);
|
||||||
|
if (this.input.read() == 2 && this.input.read() != 0) {
|
||||||
|
Packet.a(this.input, 16);
|
||||||
|
Packet.a(this.input, 255);
|
||||||
|
this.input.readInt();
|
||||||
|
|
||||||
|
if (this.q) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.m.clear();
|
||||||
|
this.m.add(new Packet2Handshake(null));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
this.input.reset();
|
||||||
|
// CraftBukkit end
|
||||||
Packet packet = Packet.a(this.input, this.packetListener.c());
|
Packet packet = Packet.a(this.input, this.packetListener.c());
|
||||||
|
|
||||||
if (packet != null) {
|
if (packet != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user