This repository has been archived by the owner on Mar 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Main.cs
49 lines (46 loc) · 1.51 KB
/
Main.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
using Exiled.API.Features;
using System;
using System.Collections.Generic;
using System.IO;
using Player = Exiled.Events.Handlers.Player;
using Server = Exiled.Events.Handlers.Server;
namespace XPSystem
{
public class Main : Plugin<Config>
{
public static Main Instance { get; set; }
public override Version Version { get; } = new Version(1, 0, 7);
public override Version RequiredExiledVersion { get; } = new Version(5, 0, 0);
private EventHandlers handlers;
public static Dictionary<string, PlayerLog> players = new Dictionary<string, PlayerLog>();
private void Deserialize()
{
if (!File.Exists(Instance.Config.SavePath))
{
YamlPly.Save();
return;
}
YamlPly.Read();
}
public override void OnEnabled()
{
handlers = new EventHandlers();
Player.Verified += handlers.OnJoined;
Player.Dying += handlers.OnKill;
Server.RoundEnded += handlers.OnRoundEnd;
Player.Escaping += handlers.OnEscape;
Instance = this;
Deserialize();
base.OnEnabled();
}
public override void OnDisabled()
{
Player.Verified -= handlers.OnJoined;
Player.Dying -= handlers.OnKill;
Server.RoundEnded -= handlers.OnRoundEnd;
Player.Escaping -= handlers.OnEscape;
handlers = null;
base.OnDisabled();
}
}
}