Skip to content

Commit fb822fc

Browse files
authored
feat: add database support and restructure configuration classes
This update introduces database functionality for notification tracking and improves the overall configuration structure to enhance organization and maintainability. This database implementation lays the foundation for cross-server notification sharing.
2 parents 78df369 + cc67206 commit fb822fc

26 files changed

+1141
-515
lines changed

.github/FUNDING.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1 @@
1-
# These are supported funding model platforms
2-
3-
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4-
patreon: # Replace with a single Patreon username
5-
open_collective: # Replace with a single Open Collective username
6-
ko_fi: # Replace with a single Ko-fi username
7-
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8-
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9-
liberapay: # Replace with a single Liberapay username
10-
issuehunt: # Replace with a single IssueHunt username
11-
otechie: # Replace with a single Otechie username
12-
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13-
polar: # Replace with a single Polar username
141
custom: ['https://paypal.me/lucauy']

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
bin
22
obj
3-
.vs
3+
.vs
4+
*.sln

Config.cs

Lines changed: 0 additions & 86 deletions
This file was deleted.

Configs/BaseConfigs.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using CounterStrikeSharp.API.Core;
2+
using System.Text.Json.Serialization;
3+
4+
namespace NeedSystem.Configs;
5+
6+
public class BaseConfigs : BasePluginConfig
7+
{
8+
[JsonPropertyName("Commands")]
9+
public CommandSettings Commands { get; set; } = new();
10+
11+
[JsonPropertyName("ServerSettings")]
12+
public ServerSettings Server { get; set; } = new();
13+
14+
[JsonPropertyName("DiscordSettings")]
15+
public DiscordSettings Discord { get; set; } = new();
16+
17+
[JsonPropertyName("PlayerSettings")]
18+
public PlayerSettings Player { get; set; } = new();
19+
20+
[JsonPropertyName("Database")]
21+
public DatabaseConfig Database { get; set; } = new();
22+
}

Configs/CommandSettings.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace NeedSystem.Configs;
4+
5+
public class CommandSettings
6+
{
7+
[JsonPropertyName("Command")]
8+
public List<string> Command { get; set; } = new List<string> { "css_need", ".need" };
9+
10+
[JsonPropertyName("CommandCooldownSeconds")]
11+
public int CooldownSeconds { get; set; } = 120;
12+
}

Configs/DatabaseConfig.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace NeedSystem.Configs;
4+
5+
public class DatabaseConfig
6+
{
7+
[JsonPropertyName("Enabled")]
8+
public bool Enabled { get; set; } = false;
9+
10+
[JsonPropertyName("Host")]
11+
public string Host { get; set; } = "localhost";
12+
13+
[JsonPropertyName("Port")]
14+
public uint Port { get; set; } = 3306;
15+
16+
[JsonPropertyName("User")]
17+
public string User { get; set; } = "root";
18+
19+
[JsonPropertyName("Password")]
20+
public string Password { get; set; } = "";
21+
22+
[JsonPropertyName("DatabaseName")]
23+
public string DatabaseName { get; set; } = "needsystem";
24+
}

Configs/DiscordSettings.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace NeedSystem.Configs;
4+
5+
public class DiscordSettings
6+
{
7+
[JsonPropertyName("WebhookUrl")]
8+
public string WebhookUrl { get; set; } = "";
9+
10+
[JsonPropertyName("MentionRoleID")]
11+
public string MentionRoleID { get; set; } = "";
12+
13+
[JsonPropertyName("MentionMessage")]
14+
public bool MentionMessage { get; set; } = true;
15+
16+
[JsonPropertyName("PlayerNameList")]
17+
public bool ShowPlayerNameList { get; set; } = true;
18+
19+
[JsonPropertyName("EmbedSettings")]
20+
public EmbedSettings Embed { get; set; } = new();
21+
}

Configs/EmbedSettings.cs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace NeedSystem.Configs;
4+
5+
public class EmbedSettings
6+
{
7+
[JsonPropertyName("EmbedColor")]
8+
public string Color { get; set; } = "#ffb800";
9+
10+
[JsonPropertyName("EmbedImage")]
11+
public bool ShowImage { get; set; } = true;
12+
13+
[JsonPropertyName("ImagesURL")]
14+
public string ImagesURL { get; set; } = "https://cdn.jsdelivr.net/gh/wiruwiru/MapsImagesCDN-CS/png/{map}.png";
15+
16+
[JsonPropertyName("FooterSettings")]
17+
public EmbedFooterSettings Footer { get; set; } = new();
18+
19+
[JsonPropertyName("AuthorSettings")]
20+
public EmbedAuthorSettings Author { get; set; } = new();
21+
22+
[JsonPropertyName("ThumbnailSettings")]
23+
public EmbedThumbnailSettings Thumbnail { get; set; } = new();
24+
}
25+
26+
public class EmbedFooterSettings
27+
{
28+
[JsonPropertyName("EmbedFooter")]
29+
public bool Enabled { get; set; } = true;
30+
31+
[JsonPropertyName("EmbedFooterImage")]
32+
public string ImageUrl { get; set; } = "https://avatars.githubusercontent.com/u/61034981?v=4";
33+
}
34+
35+
public class EmbedAuthorSettings
36+
{
37+
[JsonPropertyName("EmbedAuthor")]
38+
public bool Enabled { get; set; } = true;
39+
40+
[JsonPropertyName("EmbedAuthorURL")]
41+
public string Url { get; set; } = "https://lucauy.dev";
42+
43+
[JsonPropertyName("EmbedAuthorImage")]
44+
public string ImageUrl { get; set; } = "https://avatars.githubusercontent.com/u/61034981?v=4";
45+
}
46+
47+
public class EmbedThumbnailSettings
48+
{
49+
[JsonPropertyName("EmbedThumbnail")]
50+
public bool Enabled { get; set; } = true;
51+
52+
[JsonPropertyName("EmbedThumbnailImage")]
53+
public string ImageUrl { get; set; } = "https://avatars.githubusercontent.com/u/61034981?v=4";
54+
}

Configs/PlayerSettings.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace NeedSystem.Configs;
4+
5+
public class PlayerSettings
6+
{
7+
[JsonPropertyName("NotifyAllPlayers")]
8+
public bool NotifyAllPlayers { get; set; } = false;
9+
10+
[JsonPropertyName("DontCountSpecAdmins")]
11+
public bool DontCountSpecAdmins { get; set; } = false;
12+
13+
[JsonPropertyName("AdminBypassFlag")]
14+
public string AdminBypassFlag { get; set; } = "@css/generic";
15+
}

Configs/ServerSettings.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace NeedSystem.Configs;
4+
5+
public class ServerSettings
6+
{
7+
[JsonPropertyName("IPandPORT")]
8+
public string IPandPORT { get; set; } = "45.235.99.18:27025";
9+
10+
[JsonPropertyName("GetIPandPORTautomatic")]
11+
public bool GetIPandPORTautomatic { get; set; } = true;
12+
13+
[JsonPropertyName("UseHostname")]
14+
public bool UseHostname { get; set; } = false;
15+
16+
[JsonPropertyName("CustomDomain")]
17+
public string CustomDomain { get; set; } = "https://crisisgamer.com/connect";
18+
19+
[JsonPropertyName("MaxServerPlayers")]
20+
public int MaxServerPlayers { get; set; } = 12;
21+
22+
[JsonPropertyName("GetMaxServerPlayers")]
23+
public bool GetMaxServerPlayers { get; set; } = true;
24+
25+
[JsonPropertyName("MinPlayers")]
26+
public int MinPlayers { get; set; } = 10;
27+
}

0 commit comments

Comments
 (0)