A network packet type used by the APLib protocol to send printable JSON-formatted messages. PrintJSONPacket declares the command name and contains an array of PrintJSONPart entries, each describing a fragment of text plus optional metadata like color, flags, player, item, location and an optional semantic type.
using System.Text.Json.Serialization;
namespace APLib.Protocol.Packets;
public sealed class PrintJSONPacket : APPacket
{
public override string Command => "PrintJSON";
[JsonPropertyName( "data" )]
public PrintJSONPart[] Data { get; set; } = [];
}
#nullable enable
public sealed class PrintJSONPart
{
[JsonPropertyName( "text" )]
public string Text { get; set; } = string.Empty;
[JsonPropertyName( "type" )]
public string? Type { get; set; }
[JsonPropertyName( "color" )]
public string? Color { get; set; }
[JsonPropertyName( "flags" )]
public int? Flags { get; set; }
[JsonPropertyName( "player" )]
public int? Player { get; set; }
[JsonPropertyName( "item" )]
public long? Item { get; set; }
[JsonPropertyName( "location" )]
public long? Location { get; set; }
}