-
Notifications
You must be signed in to change notification settings - Fork 1
/
ZaupWhitelist.cs
70 lines (67 loc) · 2.31 KB
/
ZaupWhitelist.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using System;
using System.Collections.Generic;
using System.Linq;
using Rocket.API;
using Rocket.API.Collections;
using Rocket.Core.Logging;
using Rocket.Core.Plugins;
using Rocket.Unturned.Plugins;
using SDG.Unturned;
using Steamworks;
namespace ZaupWhitelist
{
class ZaupWhitelist : RocketPlugin<ZaupWhitelistConfiguration>
{
public static ZaupWhitelist Instance;
public WLDatabaseManager Database;
public override TranslationList DefaultTranslations
{
get
{
return new TranslationList
{
{
"command_generic_invalid_parameter",
"Invalid format."
},
{
"command_generic_invalid_steamid",
"{0} is an invalid SteamID format."
},
{
"default_permit_message",
"You have added {0} {1} to the whitelist."
},
{
"default_unpermit_message",
"You have removed {0} from the whitelist."
},
{
"no_player_found_unpermit",
"No player found that has id {0}."
},
{
"update_whitelist_mysql_message",
"Whitelist up to date from Mysql Database."
}
};
}
}
protected override void Load()
{
ZaupWhitelist.Instance = this;
this.Database = new WLDatabaseManager();
this.UpdateWhitelist();
}
protected void UpdateWhitelist()
{
if (!ZaupWhitelist.Instance.Configuration.Instance.AddtoGameWhitelist) return; // Do nothing as we are actively using the whitelist in game
List<WhitelistRow> whitelist = ZaupWhitelist.Instance.Database.GetWhitelist();
foreach (WhitelistRow row in whitelist)
{
SteamWhitelist.whitelist(row.steamId, row.name, row.modId);
}
Logger.Log(ZaupWhitelist.Instance.Translate("update_whitelist_mysql_message", new object[0]));
}
}
}