-
Notifications
You must be signed in to change notification settings - Fork 0
/
Plugin.cs
55 lines (46 loc) · 1.41 KB
/
Plugin.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
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 Replacer
{
public class Plugin : Plugin<Config>
{
public override string Author { get; } = "DGvagabond";
public override string Name { get; } = "Replacer";
public override Version Version { get; } = new Version(1, 1, 1);
public override Version RequiredExiledVersion { get; } = new Version(2, 1, 1);
private Handlers.Player PlayerEvents;
public static Plugin Singleton;
public override void OnEnabled()
{
try
{
base.OnEnabled();
LoadEvents();
}
catch (Exception e)
{
Log.Error($"There was an error loading the plugin: {e}");
}
}
public override void OnDisabled()
{
base.OnDisabled();
UnloadEvents();
}
private void LoadEvents()
{
Singleton = this;
PlayerEvents = new Handlers.Player(this);
Player.Left += PlayerEvents.OnLeave;
}
private void UnloadEvents()
{
Player.Left -= PlayerEvents.OnLeave;
PlayerEvents = null;
}
}
}