2021-12-25 22:36:38 +01:00
|
|
|
#pragma once
|
|
|
|
|
2023-04-28 23:47:58 +02:00
|
|
|
typedef vector<std::pair<string, uint64_t>> BannedVec_t;
|
|
|
|
|
2023-06-22 09:09:38 +02:00
|
|
|
enum EKickType
|
|
|
|
{
|
|
|
|
KICK_NAME = 0,
|
|
|
|
KICK_ID,
|
|
|
|
BAN_NAME,
|
|
|
|
BAN_ID
|
|
|
|
};
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
class CBanSystem
|
|
|
|
{
|
|
|
|
public:
|
2022-02-19 02:31:16 +01:00
|
|
|
void Load(void);
|
|
|
|
void Save(void) const;
|
|
|
|
|
2023-04-29 12:15:51 +02:00
|
|
|
bool AddEntry(const char* ipAddress, const uint64_t nucleusId);
|
|
|
|
bool DeleteEntry(const char* ipAddress, const uint64_t nucleusId);
|
2022-06-14 20:56:55 +02:00
|
|
|
|
2023-04-29 12:15:51 +02:00
|
|
|
bool IsBanned(const char* ipAddress, const uint64_t nucleusId) const;
|
2022-02-19 02:31:16 +01:00
|
|
|
bool IsBanListValid(void) const;
|
|
|
|
|
2023-04-28 23:47:58 +02:00
|
|
|
void KickPlayerByName(const char* playerName, const char* reason = nullptr);
|
|
|
|
void KickPlayerById(const char* playerHandle, const char* reason = nullptr);
|
2022-09-15 23:13:37 +02:00
|
|
|
|
2023-04-28 23:47:58 +02:00
|
|
|
void BanPlayerByName(const char* playerName, const char* reason = nullptr);
|
|
|
|
void BanPlayerById(const char* playerHandle, const char* reason = nullptr);
|
2022-09-15 23:13:37 +02:00
|
|
|
|
2023-04-29 12:15:51 +02:00
|
|
|
void UnbanPlayer(const char* criteria);
|
2022-09-16 00:51:35 +02:00
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
private:
|
2023-04-28 23:47:58 +02:00
|
|
|
void AuthorPlayerByName(const char* playerName, const bool bBan, const char* reason = nullptr);
|
|
|
|
void AuthorPlayerById(const char* playerHandle, const bool bBan, const char* reason = nullptr);
|
2023-02-23 23:55:55 +01:00
|
|
|
|
2023-04-28 23:47:58 +02:00
|
|
|
BannedVec_t m_vBanList;
|
2021-12-25 22:36:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
extern CBanSystem* g_pBanSystem;
|