mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-03-07 07:31:12 +00:00
1.2.9a - fix
- Fixed native in non-main thread
This commit is contained in:
@@ -59,7 +59,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void OnConfigParsed(CS2_SimpleAdminConfig config)
|
public void OnConfigParsed(CS2_SimpleAdminConfig config)
|
||||||
{
|
{
|
||||||
if (config.DatabaseHost.Length < 1 || config.DatabaseName.Length < 1 || config.DatabaseUser.Length < 1)
|
if (config.DatabaseHost.Length < 1 || config.DatabaseName.Length < 1 || config.DatabaseUser.Length < 1)
|
||||||
{
|
{
|
||||||
@@ -77,8 +77,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
|||||||
|
|
||||||
dbConnectionString = builder.ConnectionString;
|
dbConnectionString = builder.ConnectionString;
|
||||||
|
|
||||||
|
Task.Run(async () =>
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
_database = new(dbConnectionString);
|
_database = new(dbConnectionString);
|
||||||
|
|
||||||
using (var connection = _database.GetConnection())
|
using (var connection = _database.GetConnection())
|
||||||
@@ -161,6 +164,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
|||||||
Logger.LogError("Unable to connect to the database!");
|
Logger.LogError("Unable to connect to the database!");
|
||||||
throw new Exception("[CS2-SimpleAdmin] Unable to connect to the Database!");
|
throw new Exception("[CS2-SimpleAdmin] Unable to connect to the Database!");
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Config = config;
|
Config = config;
|
||||||
_localizer = Localizer;
|
_localizer = Localizer;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using MySqlConnector;
|
using MySqlConnector;
|
||||||
|
|
||||||
|
namespace CS2_SimpleAdmin;
|
||||||
public class Database
|
public class Database
|
||||||
{
|
{
|
||||||
private readonly string _dbConnectionString;
|
private readonly string _dbConnectionString;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using CounterStrikeSharp.API.Modules.Admin;
|
|||||||
using CounterStrikeSharp.API.Modules.Commands;
|
using CounterStrikeSharp.API.Modules.Commands;
|
||||||
using CounterStrikeSharp.API.Modules.Cvars;
|
using CounterStrikeSharp.API.Modules.Cvars;
|
||||||
using Dapper;
|
using Dapper;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using static CounterStrikeSharp.API.Core.Listeners;
|
using static CounterStrikeSharp.API.Core.Listeners;
|
||||||
|
|||||||
Reference in New Issue
Block a user