-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added missing packet PingResponsePacket
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
Components/MineSharp.Protocol/Packets/Clientbound/Play/PingResponsePacket.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using MineSharp.Core.Serialization; | ||
using MineSharp.Data; | ||
using MineSharp.Data.Protocol; | ||
|
||
namespace MineSharp.Protocol.Packets.Clientbound.Play; | ||
|
||
/// <summary> | ||
/// Ping response packet | ||
/// </summary> | ||
/// <param name="Payload">The payload, should be the same as sent by the client</param> | ||
public sealed record PingResponsePacket(long Payload) : IPacket | ||
{ | ||
/// <inheritdoc /> | ||
public PacketType Type => StaticType; | ||
/// <inheritdoc /> | ||
public static PacketType StaticType => PacketType.CB_Play_PingResponse; | ||
|
||
/// <inheritdoc/> | ||
public void Write(PacketBuffer buffer, MinecraftData version) | ||
{ | ||
buffer.WriteLong(Payload); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public static IPacket Read(PacketBuffer buffer, MinecraftData version) | ||
{ | ||
var payload = buffer.ReadLong(); | ||
|
||
return new PingResponsePacket(payload); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters