Commit graph

14 commits

Author SHA1 Message Date
Anon
7a75328f0a Fixed a JSON exception 2026-03-26 19:16:48 +01:00
Anon
757cbe1a68 Fix ParseJson crash on non-JSON plain-text input (e.g. vanilla MOTD)
When the MC server sends a plain-text string (not valid JSON) for fields like
the ServerData MOTD, JsonNode.Parse() throws JsonReaderException. This was a
regression introduced by the System.Text.Json modernization.

Fix: catch JsonException in ParseJson() and return JsonValue.Create(json) so
plain-text strings are treated as literal string values rather than crashing.

Tested against a real Minecraft 1.21.11 server (offline mode): MCC connects
and stays connected without crashing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-22 19:53:15 +01:00
copilot-swe-agent[bot]
d2c1cbf2a5 Fix Json.ParseJson crash on empty/null input
ParseJson now returns null for null, empty, or whitespace-only input
instead of throwing JsonReaderException. This matches the behavior of
the old hand-rolled parser and is needed because MC protocol packets
may contain empty strings where JSON text is expected (e.g. empty chat
messages in DeathCombatEvent packets).

Discovered during end-to-end testing against a Minecraft 1.21.11
protocol server.

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/milutinke/Minecraft-Console-Client/sessions/34df723e-4a63-45a0-a942-e119d81a575b
2026-03-22 17:22:08 +00:00
copilot-swe-agent[bot]
15aabd9423 Replace legacy custom JSON parser with System.Text.Json
- Rewrite Json.cs to use System.Text.Json.Nodes (JsonNode, JsonObject, JsonArray)
- Add JsonNodeExtensions.GetStringValue() for backward-compatible string access
- Update all 14 consumer files to use the new JsonNode API
- Remove ~300 lines of hand-rolled JSON parsing code from 2013
- Replace KeyUtils.EscapeString with delegation to Json.EscapeString

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/milutinke/Minecraft-Console-Client/sessions/afcd1b7b-ea23-4a0d-bb46-a90b623406fc
2026-03-22 16:39:26 +00:00
Anon
1efa55206f Re-added WebSocketChat bot and improved it, no longer using WebsocketSharp library 2023-05-27 19:46:28 +02:00
BruceChen
84cf749344 Implement command completion suggestions. 2022-12-06 15:50:17 +08:00
BruceChen
4925689496
Revert "Added the Web Socket Chat Bot" 2022-10-25 16:23:25 +08:00
Milutinke
ed910aa9c7 Added the Web Socket Chat Bot. 2022-10-20 19:29:35 +02:00
BruceChen
53898f3446 Fix xxx.Parse 2022-10-04 11:53:07 +08:00
BruceChen
1d52d1eadd
Fix all warnings & Trim (#2226)
* Fix AutoFishing crash
* Fix all warnings
* Remove DotNetZip.
* Fix the usage of HttpClient.
2022-10-02 18:31:08 +08:00
LesterLian
621e5e2200
Implement Realms support (#1533)
Resolve #51 

* Realms: update to new API; fix HTTP Get

* Realms: suggested changes

Co-authored-by: ORelio <ORelio@users.noreply.github.com>

* Realms: suggested changes

Co-authored-by: ORelio <ORelio@users.noreply.github.com>

* Add negative number support for JSON parser

* Nice print realms worlds result

* Option to join Realms world with world ID

* Suggested changes

Co-authored-by: ORelio <ORelio@users.noreply.github.com>

* Failure handle

Co-authored-by: ORelio <ORelio@users.noreply.github.com>

* world id paired with index

* fix text

* Clean up the code a bit

* Add setting for displaying Realms worlds

* Rename Realms worlds setting

* Put messages into translation file

Co-authored-by: Zizhen Lian <zizhlian@umd.edu>
Co-authored-by: ORelio <ORelio@users.noreply.github.com>
Co-authored-by: ReinforceZwei <39955851+ReinforceZwei@users.noreply.github.com>
2021-04-12 19:46:33 +08:00
ORelio
e06438b582 Json parsing fixes
Fix parsing empty arrays and objects containing spaces
See ORelio/Sharp-Tools#1 for more details
2020-12-24 14:32:25 +01:00
ORelio
214f8a23da Fix \n Json decoding and allow line breaks in chat
See #281
2017-06-07 20:52:08 +02:00
ORelio
9f1ef83680 Move Json class into main package
See #138
2017-05-06 21:08:56 +02:00
Renamed from MinecraftClient/Protocol/Handlers/Json.cs (Browse further)