Skip to content

Commit

Permalink
Merge pull request #4 from oscar-wos/1.3.1
Browse files Browse the repository at this point in the history
feat: TestPlugin
  • Loading branch information
oscar-wos authored Jun 1, 2024
2 parents 44a26d9 + dd2a9aa commit af8d4c7
Show file tree
Hide file tree
Showing 7 changed files with 746 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
src/bin/
src/obj/
Sessions.API/bin/
Sessions.API/obj/
Sessions.API/obj/
TestPlugin/bin/
TestPlugin/obj/
675 changes: 675 additions & 0 deletions LICENSE.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Supports postgresql + mysql
`counterstrikesharp/configs/plugins/Sessions/Sessions.json`
```
{
"DatabaseType": "mysql",
}
{
"DatabaseType": "postgresql",
}
```
### Aliases
![image](https://github.com/oscar-wos/Sessions/assets/29248751/983c65eb-746a-4759-9b39-76efded4177b)

### Players
![image](https://github.com/oscar-wos/Sessions/assets/29248751/7edd304a-6b4c-4d22-98b5-54cd24cba64c)

### Messages
![image](https://github.com/oscar-wos/Sessions/assets/29248751/097d1018-9c78-418e-8583-1d454721a800)

### Sessions
![image](https://github.com/oscar-wos/Sessions/assets/29248751/278eadbd-e76c-4801-ab07-f9d4933955af)
![image](https://github.com/oscar-wos/Sessions/assets/29248751/331a4858-6611-476a-ba8e-ddd43fa6ede0)
10 changes: 8 additions & 2 deletions Sessions.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.34928.147
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sessions", "src\Sessions.csproj", "{94ACB340-F4BC-4913-88D6-4153C265DE13}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sessions", "src\Sessions.csproj", "{94ACB340-F4BC-4913-88D6-4153C265DE13}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sessions.API", "Sessions.API\Sessions.API.csproj", "{2EF1ABD8-B691-4C06-84F4-3BE8901DE14F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sessions.API", "Sessions.API\Sessions.API.csproj", "{2EF1ABD8-B691-4C06-84F4-3BE8901DE14F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestPlugin", "TestPlugin\TestPlugin.csproj", "{CB4816B2-D0B7-4B6F-8FAA-CC1611007E1E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -21,6 +23,10 @@ Global
{2EF1ABD8-B691-4C06-84F4-3BE8901DE14F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2EF1ABD8-B691-4C06-84F4-3BE8901DE14F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2EF1ABD8-B691-4C06-84F4-3BE8901DE14F}.Release|Any CPU.Build.0 = Release|Any CPU
{CB4816B2-D0B7-4B6F-8FAA-CC1611007E1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB4816B2-D0B7-4B6F-8FAA-CC1611007E1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB4816B2-D0B7-4B6F-8FAA-CC1611007E1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB4816B2-D0B7-4B6F-8FAA-CC1611007E1E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
22 changes: 22 additions & 0 deletions TestPlugin/TestPlugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Capabilities;
using Sessions.API;

namespace TestPlugin;

public class TestPlugin : BasePlugin
{
public override string ModuleName => "TestPlugin";
public override string ModuleVersion => "1.0.0";

private static PlayerCapability<ISessionsPlayer> CapabilityPlayer { get; } = new("sessions:player");

public override void Load(bool isReload)
{
foreach (var session in Utilities.GetPlayers().Select(player => CapabilityPlayer.Get(player)!.Session))
{
Console.WriteLine(session!.Id);
}
}
}
14 changes: 14 additions & 0 deletions TestPlugin/TestPlugin.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CounterStrikeSharp.API" Version="*" ExcludeAssets="runtime" />
<ProjectReference Include="..\Sessions.API\Sessions.API.csproj" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/SqlService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public async Task CreateTablesAsync()
}
}

public async Task<Server?> GetServerAsync(string serverIp, ushort serverPort)
public async Task<Server> GetServerAsync(string serverIp, ushort serverPort)
{
try
{
Expand Down

0 comments on commit af8d4c7

Please sign in to comment.