-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainPlugin.cs
More file actions
74 lines (56 loc) · 1.98 KB
/
Copy pathMainPlugin.cs
File metadata and controls
74 lines (56 loc) · 1.98 KB
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
71
72
73
74
using LabApi.Features;
using LabApi.Features.Console;
using LabApi.Loader;
using LabApi.Loader.Features.Plugins;
using LabApi.Loader.Features.Plugins.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UsefulAdditions.Features;
namespace UsefulAdditions;
public class MainPlugin : Plugin<UACongfig>
{
public static MainPlugin Instance { get; set; } = null!;
private bool _hasIncorrectSettings = false;
public UACongfig uaconfig; //插件配置
public override LoadPriority Priority { get; } = LoadPriority.High;// 插件加载优先级
public override string Name { get; } = "UsefulAdditions"; // 插件名称
public override string Description { get; } = "一个优秀的多功能插件!"; // 插件描述
public override string Author { get; } = "Crystal";// 插件作者
public override Version Version { get; } = new Version(1, 0, 0); // 插件版本
public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion); // 插件依赖的 API 版本
private ScpHealSystem _scpHeal;
private FasterRespawnSystem _fasterRespawn;
public override void LoadConfigs()
{
_hasIncorrectSettings = !this.TryLoadConfig("config.yml", out uaconfig);
base.LoadConfigs();
}
public override void Enable()
{
Instance = this;
if (_hasIncorrectSettings)
{
Logger.Error($"{Name} 配置文件加载失败,请检查 config.yml 格式或删除后重启!");
return;
}
if (Config.SCPHeal)
{
_scpHeal = new ScpHealSystem(this);
_scpHeal.Enable();
}
if (Config.FasterRespawn)
{
_fasterRespawn = new FasterRespawnSystem(this);
_fasterRespawn.Enable();
}
}
public override void Disable()
{
_scpHeal?.Disable();
_fasterRespawn?.Disable();
Instance = null!;
}
}