sbpp / sourcebans-pp

Admin, ban, and comms management system for the Source engine
https://sbpp.github.io/
Creative Commons Attribution Share Alike 4.0 International
327 stars 175 forks source link

feat: cache data, small refactor, add steamid in banip, bugs fix #957

Closed Rushaway closed 1 month ago

Rushaway commented 1 month ago

Description

  1. Cachae players data to make less repeatitive calls
  2. Prevent banning people without correct steamid format (can lead to create https://github.com/sbpp/sourcebans-pp/issues/912 || https://github.com/sbpp/sourcebans-pp/pull/908#issuecomment-1646728085)
  3. Add SteamID into CommandIP
  4. Small refacotring to match sbpp comms code style (A full refactor will come in another PR later)
  5. Improve string speed comparaison

Motivation and Context

  1. Less calls to get the same data, DRY the code.
  2. Fix #912
  3. While banning someone via IP, the steamid was never stored, it was no-sense, it easier to track a player banned (via the steamid in search function of the website instead of IP who can be dynamic for the same SteamID) + that also make the total bans counts correct
  4. After years and multiples PR from contributors, the global code style is different from one function to another
  5. strcmp is way faster than StrEqual (benchmarks was made)

How Has This Been Tested?

In use since 6 months on https://bans.nide.gg/

Types of changes

Checklist:

Edit: My bad, I didnt pushed the latest version of the plugin, this is now solved.