forked from x3rt/SCPChat
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Plugin.cs
59 lines (51 loc) · 1.84 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
56
57
58
59
using Exiled.API.Enums;
using Exiled.API.Features;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Exiled.Events;
using Exiled.Loader;
using Server = Exiled.Events.Handlers.Server;
namespace SCPChat
{
public class Plugin : Plugin<Config>
{
public override string Name => typeof(Plugin).Namespace;
public override string Author => "x3rt, modified by Killla";
public override Version RequiredExiledVersion { get; } = new Version(5, 2, 0);
public override Version Version { get; } = new Version(1, 1, 0);
public override PluginPriority Priority { get; } = PluginPriority.Last;
private readonly EventHandlers _eventHandlers = new EventHandlers();
internal static Config SharedConfig { get; set; }
internal static List<string> ChatMessages { get; set; } = new List<string>();
public Plugin()
{
}
public override void OnEnabled()
{
Assembly assembly = Loader.Plugins.FirstOrDefault(pl => pl.Name == "AdvancedHints")?.Assembly;
if (assembly == null)
{
Log.Error("AdvancedHints not found! SCPChat will not work! Download it at https://github.com/BuildBoy12/AdvancedHints/releases and place it in your Exiled/Plugins folder");
return;
}
SharedConfig = Config;
RegisterEvents();
base.OnEnabled();
}
public override void OnDisabled()
{
UnregisterEvents();
base.OnDisabled();
}
private void RegisterEvents()
{
Server.WaitingForPlayers += _eventHandlers.OnWaitingForPlayers;
}
private void UnregisterEvents()
{
Server.WaitingForPlayers -= _eventHandlers.OnWaitingForPlayers;
}
}
}