- Timestamp:
- Sep 4, 2018, 1:00:48 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/Web/API/GetPlayersOnline.cs
r324 r325 1 using System.Collections.Generic; 2 using System.Net; 1 3 using AllocsFixes.JSON; 2 4 using AllocsFixes.PersistentData; 3 using System;4 using System.Collections.Generic;5 using System.Net;6 5 7 namespace AllocsFixes.NetConnections.Servers.Web.API 8 { 9 public class GetPlayersOnline : WebAPI 10 { 11 public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel) 12 { 13 JSONArray players = new JSONArray(); 6 namespace AllocsFixes.NetConnections.Servers.Web.API { 7 public class GetPlayersOnline : WebAPI { 8 public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, 9 int permissionLevel) { 10 JSONArray players = new JSONArray (); 14 11 15 12 World w = GameManager.Instance.World; … … 18 15 Player player = PersistentContainer.Instance.Players [ci.playerId, false]; 19 16 20 JSONObject pos = new JSONObject ();21 pos.Add ("x", new JSONNumber ((int) current.Value.GetPosition ().x));22 pos.Add ("y", new JSONNumber ((int) current.Value.GetPosition ().y));23 pos.Add ("z", new JSONNumber ((int) current.Value.GetPosition ().z));17 JSONObject pos = new JSONObject (); 18 pos.Add ("x", new JSONNumber ((int) current.Value.GetPosition ().x)); 19 pos.Add ("y", new JSONNumber ((int) current.Value.GetPosition ().y)); 20 pos.Add ("z", new JSONNumber ((int) current.Value.GetPosition ().z)); 24 21 25 JSONObject p = new JSONObject ();22 JSONObject p = new JSONObject (); 26 23 p.Add ("steamid", new JSONString (ci.playerId)); 27 24 p.Add ("entityid", new JSONNumber (ci.entityId)); … … 46 43 p.Add ("ping", new JSONNumber (ci != null ? ci.ping : -1)); 47 44 48 players.Add (p);45 players.Add (p); 49 46 } 50 47 51 WriteJSON (resp, players);48 WriteJSON (resp, players); 52 49 } 53 50 } 54 51 } 55
Note:
See TracChangeset
for help on using the changeset viewer.