Archiviert
13
0

Fix issues with determining async packets

Fixes #27
Dieser Commit ist enthalten in:
Dan Mulloy 2014-12-31 18:26:35 -05:00
Ursprung 10f9c4c9f9
Commit 5605c3817e
2 geänderte Dateien mit 15 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -419,8 +419,20 @@ public class AsyncMarker implements Serializable, Comparable<AsyncMarker> {
alwaysSync = true;
} else if (MinecraftVersion.getCurrentVersion().equals(MinecraftVersion.BOUNTIFUL_UPDATE)) {
// The centralized async marker was removed in 1.8
// The only packet I know for sure is async is incoming chat
return event.getPacketType() == PacketType.Play.Client.CHAT;
// Incoming chat packets can be async
if (event.getPacketType() == PacketType.Play.Client.CHAT) {
String content = event.getPacket().getStrings().readSafely(0);
if (content != null) {
// Incoming chat packets are async only if they aren't commands
return ! content.startsWith("/");
} else {
System.err.println("[ProtocolLib] Failed to determine contents of incoming chat packet!");
alwaysSync = true;
}
} else {
// TODO: Find more cases of async packets
return false;
}
} else {
System.err.println("[ProtocolLib] Cannot determine asynchronous state of packets!");
alwaysSync = true;

Datei anzeigen

@ -316,7 +316,7 @@ public class MinecraftVersion implements Comparable<MinecraftVersion>, Serializa
public static MinecraftVersion getCurrentVersion() {
if (currentVersion == null) {
currentVersion = new MinecraftVersion(Bukkit.getVersion());
currentVersion = fromServerVersion(Bukkit.getVersion());
}
return currentVersion;