@@ -80,8 +80,8 @@ public override void MakeWebRequest(string endpoint, string body, TebexApi.HttpV
8080 Enum . TryParse < RequestMethod > ( verb . ToString ( ) , true , out method ) ;
8181 if ( method == null )
8282 {
83- LogError ( $ "Unknown HTTP method!: { verb . ToString ( ) } ") ;
84- LogError ( $ "Failed to interpret HTTP method on request { verb } { endpoint } | { body } " ) ;
83+ LogDebug ( $ "Unknown HTTP method!: { verb . ToString ( ) } { endpoint } | { body } ") ;
84+ return ;
8585 }
8686
8787 var headers = new Dictionary < string , string >
@@ -193,6 +193,12 @@ public override void MakeWebRequest(string endpoint, string body, TebexApi.HttpV
193193 LogDebug ( response ) ;
194194 onServerError ? . Invoke ( code , response ) ;
195195 }
196+ else if ( code == 530 ) // Cloudflare origin error
197+ {
198+ LogDebug ( "CDN reported error code, web request not completed: " + code ) ;
199+ LogDebug ( response ) ;
200+ onServerError ? . Invoke ( code , response ) ;
201+ }
196202 else if ( code == 0 )
197203 {
198204 ReportAutoTriageEvent ( TebexTriage . CreateAutoTriageEvent ( "Request timeout to Plugin API" ,
@@ -201,7 +207,7 @@ public override void MakeWebRequest(string endpoint, string body, TebexApi.HttpV
201207 { "request" , logOutStr } ,
202208 { "response" , logInStr } ,
203209 } ) ) ;
204- LogError ( "Request Timeout from Tebex API. Please try again later." ) ;
210+ LogDebug ( "Request Timeout from Tebex API. Please try again later." ) ;
205211 }
206212 else // This should be a general failure error message with a JSON-formatted response from the API.
207213 {
@@ -226,7 +232,7 @@ public override void MakeWebRequest(string endpoint, string body, TebexApi.HttpV
226232 { "request" , logOutStr } ,
227233 { "response" , logInStr } ,
228234 } ) ) ;
229- LogError ( $ "Failed to unmarshal an expected error response from API.") ;
235+ LogDebug ( $ "Failed to unmarshal an expected error response from API.") ;
230236 onServerError ? . Invoke ( code , response ) ;
231237 }
232238
@@ -316,13 +322,16 @@ private void ExecuteServerCommand(TebexApi.Command command, IPlayer player, stri
316322
317323 public override bool IsPlayerOnline ( string playerRefId )
318324 {
325+ // Get a reference to the in-game player instance
319326 IPlayer iPlayer = GetPlayerRef ( playerRefId ) as IPlayer ;
320- if ( iPlayer == null ) //Ensure the lookup worked
327+ if ( iPlayer == null ) // Player is not connected
321328 {
322- LogError ( $ "Attempted to look up online player, but no reference found: { playerRefId } ") ;
323329 return false ;
324330 }
325331
332+ // IsConnected might indicate just a connection to the server, but unknown if it's possible to have an IPlayer
333+ // reference and for the player to not actually be connected. This would create a case where we can't
334+ // check inventory slots prior to package delivery.
326335 return iPlayer . IsConnected ;
327336 }
328337
@@ -411,6 +420,11 @@ public override string ExpandUsernameVariables(string input, object playerObj)
411420 if ( iPlayer == null )
412421 {
413422 LogError ( $ "Could not cast player instance when expanding username variables: { playerObj } ") ;
423+ ReportAutoTriageEvent ( TebexTriage . CreateAutoTriageEvent ( "Could not cast player instance when expanding username variables" , new Dictionary < string , string >
424+ {
425+ { "input" , input } ,
426+ { "playerObj" , playerObj ? . ToString ( ) } ,
427+ } ) ) ;
414428 return input ;
415429 }
416430
@@ -419,6 +433,12 @@ public override string ExpandUsernameVariables(string input, object playerObj)
419433 LogError ( $ "Player ID or name is null while expanding username?!: { iPlayer } ") ;
420434 LogError ( $ "Base player object: { playerObj } ") ;
421435 LogError ( $ "Input command: { input } ") ;
436+ ReportAutoTriageEvent ( TebexTriage . CreateAutoTriageEvent ( "Player ID or name is null while expanding username?!: " , new Dictionary < string , string >
437+ {
438+ { "input" , input } ,
439+ { "iPlayer.Id" , iPlayer . Id } ,
440+ { "iPlayer.Name" , iPlayer . Name }
441+ } ) ) ;
422442 return input ;
423443 }
424444
0 commit comments