-
Notifications
You must be signed in to change notification settings - Fork 10
/
SCP008X.cs
81 lines (72 loc) · 2.6 KB
/
SCP008X.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
71
72
73
74
75
76
77
78
79
80
81
using System;
using Exiled.API.Features;
using Exiled.API.Enums;
using Player = Exiled.Events.Handlers.Player;
using Server = Exiled.Events.Handlers.Server;
using Exiled.Events.Handlers;
namespace SCP008X
{
public class SCP008X : Plugin<Config>
{
internal static SCP008X Instance { get; } = new SCP008X();
private SCP008X() { }
public bool outbreak {get; set; }
public override PluginPriority Priority { get; } = PluginPriority.Medium;
public override string Author { get; } = "DGvagabond";
public override string Name { get; } = "Scp008X";
public override Version Version { get; } = new Version(2, 0, 0, 0);
public override Version RequiredExiledVersion { get; } = new Version(2, 1, 16);
private EventHandlers events;
public static SCP008X Singleton;
public override void OnEnabled()
{
try
{
base.OnEnabled();
RegisterEvents();
}
catch (Exception e)
{
Log.Error($"There was an error loading the plugin: {e}");
}
}
public override void OnDisabled()
{
base.OnDisabled();
UnregisterEvents();
}
public override void OnReloaded()
{
base.OnReloaded();
}
public void RegisterEvents()
{
Singleton = this;
events = new EventHandlers(this);
Player.Died += events.OnPlayerDied;
Player.Left += events.OnPlayerLeave;
Player.Dying += events.OnPlayerDying;
Player.Hurting += events.OnPlayerHurt;
Server.RoundEnded += events.OnRoundEnd;
Player.MedicalItemUsed += events.OnHealed;
Player.ChangingRole += events.OnRoleChange;
Scp049.StartingRecall += events.OnReviving;
Scp049.FinishingRecall += events.OnRevived;
Server.RoundStarted += events.OnRoundStart;
}
public void UnregisterEvents()
{
Player.ChangingRole -= events.OnRoleChange;
Scp049.StartingRecall -= events.OnReviving;
Scp049.FinishingRecall -= events.OnRevived;
Server.RoundStarted -= events.OnRoundStart;
Player.MedicalItemUsed -= events.OnHealed;
Server.RoundEnded -= events.OnRoundEnd;
Player.Hurting -= events.OnPlayerHurt;
Player.Dying -= events.OnPlayerDying;
Player.Left -= events.OnPlayerLeave;
Player.Died -= events.OnPlayerDied;
events = null;
}
}
}