mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-09-27 20:17:04 +02:00
fix: no longer plural
This commit is contained in:
parent
a2fdc0feed
commit
e3f9718ce7
5 changed files with 10 additions and 10 deletions
|
|
@ -26,7 +26,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
||||||
public static bool voteInProgress = false;
|
public static bool voteInProgress = false;
|
||||||
public static int? ServerId = null;
|
public static int? ServerId = null;
|
||||||
|
|
||||||
public static int[]? GroupIds = [];
|
public static int[]? GroupId = [];
|
||||||
|
|
||||||
public static DiscordWebhookClient? _discordWebhookClientLog;
|
public static DiscordWebhookClient? _discordWebhookClientLog;
|
||||||
public static DiscordWebhookClient? _discordWebhookClientPenalty;
|
public static DiscordWebhookClient? _discordWebhookClientPenalty;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ namespace CS2_SimpleAdmin
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using var connection = await _database.GetConnectionAsync();
|
using var connection = await _database.GetConnectionAsync();
|
||||||
var commandText = "ALTER TABLE `sa_servers` ADD COLUMN `group_ids` VARCHAR(255) NULL AFTER `hostname`";
|
var commandText = "ALTER TABLE `sa_servers` ADD COLUMN `group_id` VARCHAR(255) NULL AFTER `hostname`";
|
||||||
|
|
||||||
using var commandSql = connection.CreateCommand();
|
using var commandSql = connection.CreateCommand();
|
||||||
commandSql.CommandText = commandText;
|
commandSql.CommandText = commandText;
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ CREATE TABLE IF NOT EXISTS `sa_servers` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`address` varchar(64) NOT NULL,
|
`address` varchar(64) NOT NULL,
|
||||||
`hostname` varchar(128) NOT NULL,
|
`hostname` varchar(128) NOT NULL,
|
||||||
`group_ids` VARCHAR(255) NULL,
|
`group_id` VARCHAR(255) NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `address` (`address`)
|
UNIQUE KEY `address` (`address`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
10
Events.cs
10
Events.cs
|
|
@ -383,20 +383,20 @@ public partial class CS2_SimpleAdmin
|
||||||
new { address, hostname });
|
new { address, hostname });
|
||||||
}
|
}
|
||||||
|
|
||||||
(int? serverId, string? groupIds) = await connection.QueryFirstAsync<(int?, string?)>(
|
(int? serverId, string? groupId) = await connection.QueryFirstAsync<(int?, string?)>(
|
||||||
"SELECT `id`, `group_ids` FROM `sa_servers` WHERE `address` = @address",
|
"SELECT `id`, `group_id` FROM `sa_servers` WHERE `address` = @address",
|
||||||
new { address });
|
new { address });
|
||||||
|
|
||||||
ServerId = serverId;
|
ServerId = serverId;
|
||||||
if (groupIds != null && groupIds.Length > 0)
|
if (groupId != null && groupId.Length > 0)
|
||||||
{
|
{
|
||||||
// Split the group ids by comma and parse them to integers
|
// Split the group ids by comma and parse them to integers
|
||||||
GroupIds = groupIds?.Split(',').Select(int.Parse).ToArray();
|
GroupId = groupId?.Split(',').Select(int.Parse).ToArray();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// We must set it to null if it's empty to ensure reloads work properly
|
// We must set it to null if it's empty to ensure reloads work properly
|
||||||
GroupIds = null;
|
GroupId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ public class AdminSQLManager
|
||||||
|
|
||||||
await using MySqlConnection connection = await _database.GetConnectionAsync();
|
await using MySqlConnection connection = await _database.GetConnectionAsync();
|
||||||
|
|
||||||
string groupId = CS2_SimpleAdmin.GroupIds != null ? string.Join("", CS2_SimpleAdmin.GroupIds) : string.Empty;
|
string groupId = CS2_SimpleAdmin.GroupId != null ? string.Join("", CS2_SimpleAdmin.GroupId) : string.Empty;
|
||||||
|
|
||||||
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, '%')));";
|
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();
|
List<dynamic>? activeFlags = (await connection.QueryAsync(sql, new { PlayerSteamID = steamId, CurrentTime = now, serverid = CS2_SimpleAdmin.ServerId, groupid = groupId }))?.ToList();
|
||||||
|
|
@ -73,7 +73,7 @@ public class AdminSQLManager
|
||||||
{
|
{
|
||||||
await using MySqlConnection connection = await _database.GetConnectionAsync();
|
await using MySqlConnection connection = await _database.GetConnectionAsync();
|
||||||
|
|
||||||
string groupId = CS2_SimpleAdmin.GroupIds != null ? string.Join("", CS2_SimpleAdmin.GroupIds) : string.Empty;
|
string groupId = CS2_SimpleAdmin.GroupId != null ? string.Join("", CS2_SimpleAdmin.GroupId) : string.Empty;
|
||||||
|
|
||||||
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, '%')));";
|
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();
|
List<dynamic>? activeFlags = (await connection.QueryAsync(sql, new { CurrentTime = now, serverid = CS2_SimpleAdmin.ServerId, groupid = groupId }))?.ToList();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue