Skip to content

Commit

Permalink
Revert "removing the Ping handler in PlayPacketHandler"
Browse files Browse the repository at this point in the history
This reverts commit f2c619f.
  • Loading branch information
psu-de committed May 5, 2024
1 parent 3b1af35 commit f162e4b
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using MineSharp.Data;
using MineSharp.Data;
using MineSharp.Data.Protocol;
using MineSharp.Protocol.Packets.Clientbound.Play;
using MineSharp.Protocol.Packets.Serverbound.Play;
Expand All @@ -23,6 +23,7 @@ public Task HandleIncoming(IPacket packet)
{
KeepAlivePacket keepAlive => HandleKeepAlive(keepAlive),
BundleDelimiterPacket bundleDelimiter => HandleBundleDelimiter(bundleDelimiter),
PingPacket ping => HandlePing(ping),
_ => Task.CompletedTask
};
}
Expand All @@ -46,4 +47,10 @@ private Task HandleBundleDelimiter(BundleDelimiterPacket bundleDelimiter)
this._client.HandleBundleDelimiter();
return Task.CompletedTask;
}

private Task HandlePing(PingPacket ping)
{
this._client.SendPacket(new PongPacket(ping.Id));
return Task.CompletedTask;
}
}

0 comments on commit f162e4b

Please sign in to comment.