mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 18:15:28 -04:00
Workaround for when ExtInfo is received after ExtEntry packets.
This commit is contained in:
parent
7208d2e7dc
commit
bd9da4d83d
@ -67,7 +67,11 @@ namespace ClassicalSharp {
|
||||
void HandleCpeExtInfo() {
|
||||
string appName = reader.ReadAsciiString();
|
||||
game.Chat.Add( "Server identified itself as: " + appName );
|
||||
cpeServerExtensionsCount = reader.ReadInt16();
|
||||
|
||||
// Workaround for MCGalaxy that send ExtEntry sync but ExtInfoAsync. This means
|
||||
// ExtEntry may sometimes arrive before ExtInfo, and thus we have to use += instead of =
|
||||
cpeServerExtensionsCount += reader.ReadInt16();
|
||||
SendCpeExtInfoReply();
|
||||
}
|
||||
|
||||
void HandleCpeExtEntry() {
|
||||
@ -92,7 +96,10 @@ namespace ClassicalSharp {
|
||||
ServerSupportsFullCP437 = true;
|
||||
}
|
||||
cpeServerExtensionsCount--;
|
||||
|
||||
SendCpeExtInfoReply();
|
||||
}
|
||||
|
||||
void SendCpeExtInfoReply() {
|
||||
if( cpeServerExtensionsCount == 0 ) {
|
||||
MakeExtInfo( Program.AppName, clientExtensions.Length );
|
||||
SendPacket();
|
||||
|
@ -173,8 +173,8 @@ namespace ClassicalSharp {
|
||||
name = Utils.RemoveEndPlus( name );
|
||||
AddEntity( entityId, name, name, true );
|
||||
|
||||
// Some servers (such as LegendCraft) declare they support ExtPlayerList but
|
||||
// don't send ExtAddPlayerName packets. So we add a special case here, even
|
||||
// Workaround for LegendCraft as it declares it supports ExtPlayerList but
|
||||
// doesn't send ExtAddPlayerName packets. So we add a special case here, even
|
||||
// though it is technically against the specification.
|
||||
if( UsingExtPlayerList ) {
|
||||
AddCpeInfo( entityId, name, name, "Players", 0 );
|
||||
|
@ -114,7 +114,7 @@ namespace ClassicalSharp {
|
||||
|
||||
while( reader.size > 0 ) {
|
||||
byte opcode = reader.buffer[0];
|
||||
// Fix for older D3 servers which wrote one byte too many for HackControl packets.
|
||||
// Workaround for older D3 servers which wrote one byte too many for HackControl packets.
|
||||
if( opcode == 0xFF && lastOpcode == PacketId.CpeHackControl ) {
|
||||
reader.Remove( 1 );
|
||||
game.LocalPlayer.CalculateJumpVelocity( 1.4f ); // assume default jump height
|
||||
|
@ -68,7 +68,7 @@ namespace ClassicalSharp {
|
||||
|
||||
/// <summary> Returns a string with a + removed if it is the last character in the string. </summary>
|
||||
public static string RemoveEndPlus( string value ) {
|
||||
// Some servers (e.g. MCDzienny) use a '+' at the end to distinguish classicube.net accounts
|
||||
// Workaround for MCDzienny (and others) use a '+' at the end to distinguish classicube.net accounts
|
||||
// from minecraft.net accounts. Unfortunately they also send this ending + to the client.
|
||||
if( String.IsNullOrEmpty( value ) ) return value;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user