aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-01-02 20:25:04 +0000
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-01-02 20:25:04 +0000
commitbe0d965142ec2078a20f402dd12d0f2f135842fe (patch)
treebc16334dddcd45cc030029c0ff08aaf224cdd709
parent49acb6d831919022745b68f474b65c19f4e62bcd (diff)
downloadNorthstarLauncher-be0d965142ec2078a20f402dd12d0f2f135842fe.tar.gz
NorthstarLauncher-be0d965142ec2078a20f402dd12d0f2f135842fe.zip
add clearbanlist command
-rw-r--r--NorthstarDedicatedTest/bansystem.cpp15
-rw-r--r--NorthstarDedicatedTest/bansystem.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/bansystem.cpp b/NorthstarDedicatedTest/bansystem.cpp
index 182506e8..610c20e4 100644
--- a/NorthstarDedicatedTest/bansystem.cpp
+++ b/NorthstarDedicatedTest/bansystem.cpp
@@ -28,6 +28,15 @@ void ServerBanSystem::OpenBanlist()
m_sBanlistStream.open(BANLIST_PATH, std::ofstream::out | std::ofstream::binary | std::ofstream::app);
}
+void ServerBanSystem::ClearBanlist()
+{
+ m_vBannedUids.clear();
+
+ // reopen the file, don't provide std::ofstream::app so it clears on open
+ m_sBanlistStream.close();
+ m_sBanlistStream.open(BANLIST_PATH, std::ofstream::out | std::ofstream::binary);
+}
+
void ServerBanSystem::BanUID(uint64_t uid)
{
m_vBannedUids.push_back(uid);
@@ -80,6 +89,11 @@ void UnbanPlayerCommand(const CCommand& args)
g_ServerBanSystem->UnbanUID(strtoll(args.Arg(1), nullptr, 10));
}
+void ClearBanlistCommand(const CCommand& args)
+{
+ g_ServerBanSystem->ClearBanlist();
+}
+
void InitialiseBanSystem(HMODULE baseAddress)
{
g_ServerBanSystem = new ServerBanSystem;
@@ -87,4 +101,5 @@ void InitialiseBanSystem(HMODULE baseAddress)
RegisterConCommand("ban", BanPlayerCommand, "bans a given player by uid or name", FCVAR_GAMEDLL);
RegisterConCommand("unban", UnbanPlayerCommand, "unbans a given player by uid", FCVAR_NONE);
+ RegisterConCommand("clearbanlist", ClearBanlistCommand, "clears all uids on the banlist", FCVAR_NONE);
} \ No newline at end of file
diff --git a/NorthstarDedicatedTest/bansystem.h b/NorthstarDedicatedTest/bansystem.h
index a1646356..8ce05308 100644
--- a/NorthstarDedicatedTest/bansystem.h
+++ b/NorthstarDedicatedTest/bansystem.h
@@ -9,6 +9,7 @@ private:
public:
void OpenBanlist();
+ void ClearBanlist();
void BanUID(uint64_t uid);
void UnbanUID(uint64_t uid);
bool IsUIDAllowed(uint64_t uid);