mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-09-27 20:17:04 +02:00
feat: Full reload and individual reload working
This commit is contained in:
parent
614348fd2a
commit
f69ba3b51c
2 changed files with 14 additions and 5 deletions
|
|
@ -396,6 +396,11 @@ public partial class CS2_SimpleAdmin
|
||||||
{
|
{
|
||||||
GroupIds = groupIds?.Split(',').Select(int.Parse).ToArray();
|
GroupIds = groupIds?.Split(',').Select(int.Parse).ToArray();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We must set it to null if it's empty to ensure reloads work properly
|
||||||
|
GroupIds = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// For testing only
|
// For testing only
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using CounterStrikeSharp.API.Modules.Entities;
|
using CounterStrikeSharp.API.Modules.Entities;
|
||||||
|
using CounterStrikeSharp.API.Modules.Utils;
|
||||||
using Dapper;
|
using Dapper;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using MySqlConnector;
|
using MySqlConnector;
|
||||||
|
|
@ -27,8 +28,10 @@ public class AdminSQLManager
|
||||||
|
|
||||||
await using MySqlConnection connection = await _database.GetConnectionAsync();
|
await using MySqlConnection connection = await _database.GetConnectionAsync();
|
||||||
|
|
||||||
string sql = "SELECT flags, immunity, ends FROM sa_admins WHERE player_steamid = @PlayerSteamID AND (ends IS NULL OR ends > @CurrentTime) AND (server_id IS NULL OR server_id = @serverid)";
|
string groupId = CS2_SimpleAdmin.GroupIds != null ? string.Join("", CS2_SimpleAdmin.GroupIds) : string.Empty;
|
||||||
List<dynamic>? activeFlags = (await connection.QueryAsync(sql, new { PlayerSteamID = steamId, CurrentTime = now, serverid = CS2_SimpleAdmin.ServerId }))?.ToList();
|
|
||||||
|
string sql = "SELECT flags, immunity, ends FROM sa_admins WHERE player_steamid = @PlayerSteamID AND (ends IS NULL OR ends > @CurrentTime) AND ((server_id IS NULL OR server_id = @serverid) OR ((@groupid IS NOT NULL AND @groupid <> 0) AND group_id LIKE CONCAT('%', @groupid, '%')));";
|
||||||
|
List<dynamic>? activeFlags = (await connection.QueryAsync(sql, new { PlayerSteamID = steamId, CurrentTime = now, serverid = CS2_SimpleAdmin.ServerId, groupid = groupId }))?.ToList();
|
||||||
|
|
||||||
if (activeFlags == null)
|
if (activeFlags == null)
|
||||||
{
|
{
|
||||||
|
|
@ -70,8 +73,10 @@ public class AdminSQLManager
|
||||||
{
|
{
|
||||||
await using MySqlConnection connection = await _database.GetConnectionAsync();
|
await using MySqlConnection connection = await _database.GetConnectionAsync();
|
||||||
|
|
||||||
string sql = "SELECT player_steamid, flags, immunity, ends FROM sa_admins WHERE (ends IS NULL OR ends > @CurrentTime) AND (server_id IS NULL OR server_id = @serverid) AND (group_id LIKE CONCAT('%', @groupid, '%'));";
|
string groupId = CS2_SimpleAdmin.GroupIds != null ? string.Join("", CS2_SimpleAdmin.GroupIds) : string.Empty;
|
||||||
List<dynamic>? activeFlags = (await connection.QueryAsync(sql, new { CurrentTime = now, serverid = CS2_SimpleAdmin.ServerId, groupid = CS2_SimpleAdmin.GroupIds }))?.ToList();
|
|
||||||
|
string sql = "SELECT player_steamid, flags, immunity, ends FROM sa_admins WHERE (ends IS NULL OR ends > @CurrentTime) AND ((server_id IS NULL OR server_id = @serverid) OR ((@groupid IS NOT NULL AND @groupid <> 0) AND group_id LIKE CONCAT('%', @groupid, '%')));";
|
||||||
|
List<dynamic>? activeFlags = (await connection.QueryAsync(sql, new { CurrentTime = now, serverid = CS2_SimpleAdmin.ServerId, groupid = groupId }))?.ToList();
|
||||||
|
|
||||||
if (activeFlags == null)
|
if (activeFlags == null)
|
||||||
{
|
{
|
||||||
|
|
@ -116,7 +121,6 @@ public class AdminSQLManager
|
||||||
//Console.WriteLine("Failed to parse one or more values.");
|
//Console.WriteLine("Failed to parse one or more values.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
filteredFlagsWithImmunity.Add((steamId, flagsValue.Split(',').ToList(), immunityValue, ends));
|
filteredFlagsWithImmunity.Add((steamId, flagsValue.Split(',').ToList(), immunityValue, ends));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue