Repository navigation
Expand file tree
/
Copy pathProjectMER.cs
More file actions
78 lines (61 loc) · 2.36 KB
/
Copy pathProjectMER.cs
File metadata and controls
78 lines (61 loc) · 2.36 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
using Exiled.API.Features;
using ProjectMER.Configs;
using ProjectMER.Events.Handlers.Internal;
using Map = Exiled.Events.Handlers.Map;
using Player = Exiled.Events.Handlers.Player;
using Server = Exiled.Events.Handlers.Server;
using Warhead = Exiled.Events.Handlers.Warhead;
namespace ProjectMER;
public class ProjectMER : Plugin<Config>
{
public static ProjectMER Singleton { 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 EventHandlers EventHandler { get; } = new();
public override void OnEnabled()
{
Singleton = this;
string pluginDir = Config.PluginDir;
MapsDir = Path.Combine(pluginDir, "Maps");
SchematicsDir = Path.Combine(pluginDir, "Schematics");
if (!Directory.Exists(pluginDir))
{
Log.Warn("Plugin directory does not exist. Creating...");
Directory.CreateDirectory(pluginDir);
}
if (!Directory.Exists(MapsDir))
{
Log.Warn("Maps directory does not exist. Creating...");
Directory.CreateDirectory(MapsDir);
}
if (Directory.Exists(SchematicsDir))
return;
Log.Warn("Schematics directory does not exist. Creating...");
Directory.CreateDirectory(SchematicsDir);
}
public void SubscribeEvents()
{
Server.WaitingForPlayers += EventHandler.OnWaitingForPlayers;
Server.RoundStarted += EventHandler.OnRoundStarted;
Player.ChangingRole += EventHandler.OnChangingRole;
Player.InteractingShootingTarget += EventHandler.OnInteractingShootingTarget;
Player.SearchingPickup += EventHandler.OnPlayerSearchingPickup;
Player.PickingUpItem += EventHandler.OnPlayerPickingUpItem;
Player.DryfiringWeapon += EventHandler.OnPlayerDryFiringWeapon;
Player.DroppingItem += EventHandler.OnPlayerDroppingItem;
Player.ReloadingWeapon += EventHandler.OnPlayerReloadingWeapon;
Map.Decontaminating += EventHandler.OnDecontaminating;
Warhead.Starting += EventHandler.OnStarting;
Warhead.Stopping += EventHandler.OnStopping;
Warhead.Detonating += EventHandler.OnWarheadDetonated;
}
public override string Name => "ProjectMER";
public override string Author => "Michal78900. Exiled port by BelgVolish";
public override Version Version => new Version(2025, 6, 2, 1);
}