-
Notifications
You must be signed in to change notification settings - Fork 0
/
Plugin.cs
61 lines (54 loc) · 1.79 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
60
61
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using LC_API.Networking;
using UnityEngine;
namespace PronounsIndicator
{
[BepInPlugin(ModGUID, ModName, ModVersion)]
[BepInDependency(LC_API.MyPluginInfo.PLUGIN_GUID)]
public class Plugin : BaseUnityPlugin
{
public const string ModGUID = "faejr.pronounsindicator";
public const string ModName = "Pronouns Indicator";
public const string ModVersion = "2.1.0";
public static ManualLogSource logger;
public static bool Initialized { get; private set; }
public static ConfigEntry<string> pronouns;
private void Awake()
{
logger = Logger;
Logger.LogInfo($"Plugin {ModGUID} is loaded!");
Initialized = false;
pronouns = Config.Bind<string>("pronouns", "pronouns", "");
LC_API.ClientAPI.CommandHandler.RegisterCommand("pronouns", (string[] args) =>
{
if (args.Length > 0 && args[0].Contains("/") && args[0].Length < 19)
{
pronouns.SetSerializedValue(args[0]);
PronounManager.SendPronouns();
}
});
}
internal void Start()
{
Initialize();
}
internal void OnDestroy()
{
Initialize();
}
void Initialize()
{
if (!Initialized)
{
Initialized = true;
GameObject gameObject = new GameObject("PronounIndicator");
DontDestroyOnLoad(gameObject);
gameObject.AddComponent<PronounManager>();
Logger.LogInfo("Pronoun Manager Started!");
Network.RegisterAll(typeof(PronounManager));
}
}
}
}