forked from ExMod-Team/EXILED
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomRole{T}.cs
More file actions
39 lines (35 loc) · 1.19 KB
/
Copy pathCustomRole{T}.cs
File metadata and controls
39 lines (35 loc) · 1.19 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
// -----------------------------------------------------------------------
// <copyright file="CustomRole{T}.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------
namespace Exiled.CustomRoles.API.Features
{
using YamlDotNet.Serialization;
/// <summary>
/// A generic base class for <see cref="CustomRole"/> that provides a typed singleton <see cref="Instance"/>.
/// </summary>
/// <typeparam name="T">The concrete <see cref="CustomRole"/> type.</typeparam>
public abstract class CustomRole<T> : CustomRole
where T : CustomRole<T>, new()
{
/// <summary>
/// Gets the singleton instance of this <see cref="CustomRole"/>.
/// </summary>
[YamlIgnore]
public static T? Instance { get; private set; }
/// <inheritdoc/>
public override void Init()
{
base.Init();
Instance = this as T;
}
/// <inheritdoc/>
public override void Destroy()
{
Instance = null;
base.Destroy();
}
}
}