- Timestamp:
- Jul 31, 2023, 4:06:13 PM (16 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/API/GetPlayerInventories.cs
r454 r455 1 1 using System.Collections.Generic; 2 using AllocsFixes.JSON;3 2 using AllocsFixes.PersistentData; 3 using JetBrains.Annotations; 4 using Utf8Json; 4 5 using Webserver; 5 6 using Webserver.WebAPI; 6 7 7 8 namespace AllocsFixes.WebAPIs { 9 [UsedImplicitly] 8 10 public class GetPlayerInventories : AbsWebAPI { 9 11 public override void HandleRequest (RequestContext _context) { 10 12 GetPlayerInventory.GetInventoryArguments (_context, out bool showIconColor, out bool showIconName); 11 13 12 JSONArray AllInventoriesResult = new JSONArray (); 14 JsonWriter writer = new JsonWriter (); 15 16 writer.WriteBeginArray (); 17 18 bool first = true; 13 19 14 20 foreach (KeyValuePair<PlatformUserIdentifierAbs, Player> kvp in PersistentContainer.Instance.Players.Dict) { … … 20 26 21 27 if (p.IsOnline) { 22 AllInventoriesResult.Add (GetPlayerInventory.DoPlayer (p, showIconColor, showIconName)); 28 if (!first) { 29 writer.WriteValueSeparator (); 30 } 31 32 first = false; 33 34 GetPlayerInventory.DoPlayer (ref writer, p, showIconColor, showIconName); 23 35 } 24 36 } 25 26 LegacyApiHelper.WriteJSON (_context.Response, AllInventoriesResult); 37 38 writer.WriteEndArray (); 39 40 WebUtils.WriteJsonData (_context.Response, ref writer); 27 41 } 28 42 }
Note:
See TracChangeset
for help on using the changeset viewer.