forked from Michal78900/ProjectMER
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectMER.cs
More file actions
89 lines (66 loc) · 2.59 KB
/
ProjectMER.cs
File metadata and controls
89 lines (66 loc) · 2.59 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
global using Logger = LabApi.Features.Console.Logger;
using LabApi.Events.CustomHandlers;
using LabApi.Loader.Features.Paths;
using LabApi.Loader.Features.Plugins;
using ProjectMER.Configs;
using ProjectMER.Events.Handlers.Internal;
namespace ProjectMER;
public class ProjectMER : Plugin<Config>
{
public static ProjectMER Singleton { get; private set; }
/// <summary>
/// Gets the MapEditorReborn parent folder path.
/// </summary>
public static string PluginDir { get; private set; }
/// <summary>
/// Gets the folder path in which the maps are stored.
/// </summary>
public static string MapsDir { get; private set; }
/// <summary>
/// Gets the folder path in which the schematics are stored.
/// </summary>
public static string SchematicsDir { get; private set; }
public GenericEventsHandler GenericEventsHandler { get; } = new();
public ToolGunEventsHandler ToolGunEventsHandler { get; } = new();
public MapOnEventHandlers MapOnEventHandlers { get; } = new();
public PickupEventsHandler PickupEventsHandler { get; } = new();
public override void Enable()
{
Singleton = this;
PluginDir = Path.Combine(PathManager.Configs.FullName, "ProjectMER");
MapsDir = Path.Combine(PluginDir, "Maps");
SchematicsDir = Path.Combine(PluginDir, "Schematics");
if (!Directory.Exists(PluginDir))
{
Logger.Warn("Plugin directory does not exist. Creating...");
Directory.CreateDirectory(PluginDir);
}
if (!Directory.Exists(MapsDir))
{
Logger.Warn("Maps directory does not exist. Creating...");
Directory.CreateDirectory(MapsDir);
}
if (!Directory.Exists(SchematicsDir))
{
Logger.Warn("Schematics directory does not exist. Creating...");
Directory.CreateDirectory(SchematicsDir);
}
CustomHandlersManager.RegisterEventsHandler(GenericEventsHandler);
CustomHandlersManager.RegisterEventsHandler(ToolGunEventsHandler);
CustomHandlersManager.RegisterEventsHandler(MapOnEventHandlers);
CustomHandlersManager.RegisterEventsHandler(PickupEventsHandler);
}
public override void Disable()
{
Singleton = null!;
CustomHandlersManager.UnregisterEventsHandler(GenericEventsHandler);
CustomHandlersManager.UnregisterEventsHandler(ToolGunEventsHandler);
CustomHandlersManager.UnregisterEventsHandler(MapOnEventHandlers);
CustomHandlersManager.UnregisterEventsHandler(PickupEventsHandler);
}
public override string Name => "ProjectMER";
public override string Description => "MER LabAPI";
public override string Author => "Michal78900";
public override Version Version => new Version(2025, 5, 21, 1);
public override Version RequiredApiVersion => new Version(1, 0, 0, 0);
}