BytexDigital / BytexDigital.BattlEye.Rcon

A simple to use RCON library for BattlEye
Apache License 2.0
11 stars 9 forks source link

BUGFIX: GetPlayerRequest regex expression does not capture clients with negative ping #22

Closed Okan1701 closed 3 months ago

Okan1701 commented 3 months ago

Situation

When a player client joins an Arma 3 server, it is possible for BattlEye to indicate a negative ping value (-1). The cause of this is unknown to me, but it is something that can happen regardless of what RCON client is used. See screenshot example:

image Application: battleWarden EX

The current regex expression does not handle this edgecase, causing that specific client to not get added to the result player list.

Changes

The fix to the above scenario is a small adjustment to the regex by adding an additional -? to the ping group, resulting in the following new expression: (\d+) *(\d*\.\d*\.\d*\.\d*):(\d*) *(-?\d+) *(\S{32})\((\S+)\) (.+?)(?=(?: \(Lobby\)$)|(?:$))( \(Lobby\))?

Examples

Old regex:

image

Updated regex:

image

IP has been redacted from the images

RyanTT commented 3 months ago

Hi! Thanks for the pull request. I'll upload a new version with this change soon 👍