-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPlugin.cs
More file actions
71 lines (60 loc) · 2.43 KB
/
Copy pathPlugin.cs
File metadata and controls
71 lines (60 loc) · 2.43 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System.Reflection;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using ScarletCore.Commanding;
using ScarletCore.Data;
using ScarletCore.Events;
using ScarletCore.Systems;
using ScarletCore.Localization;
namespace ScarletTemplate;
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
[BepInDependency("markvaaz.ScarletCore")]
public class Plugin : BasePlugin {
static Harmony _harmony;
public static Harmony Harmony => _harmony;
public static Plugin Instance { get; private set; }
public static ManualLogSource LogInstance { get; private set; }
public static Settings Settings { get; private set; }
public static Database Database { get; private set; }
public override void Load() {
Instance = this;
LogInstance = Log;
Log.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} version {MyPluginInfo.PLUGIN_VERSION} is loaded!");
_harmony = new Harmony(MyPluginInfo.PLUGIN_GUID);
_harmony.PatchAll(Assembly.GetExecutingAssembly());
Settings = new Settings(MyPluginInfo.PLUGIN_GUID, Instance);
Database = new Database(MyPluginInfo.PLUGIN_GUID);
GameSystems.OnInitialize(Initialize);
CommandHandler.RegisterAll();
}
private void Initialize() {
// Remove the comment below to enable localization loading from the Localization folder
// Localizer.AutoLoadFromLocalizationFolder();
}
public override bool Unload() {
_harmony?.UnpatchSelf();
ActionScheduler.UnregisterAssembly();
EventManager.UnregisterAssembly();
CommandHandler.UnregisterAssembly();
Localizer.Dispose();
return true;
}
/* Example command group using the new ScarletCore command system
[CommandGroup("example", Language.English, adminOnly: false)]
[CommandGroupAlias("exemplo", Language.Portuguese)]
public static class ExampleCommands {
[Command("hello", Language.English, description: "Say hello")]
[CommandAlias("ola", Language.Portuguese, description: "Dizer olá")]
public static void HelloCommand(CommandContext ctx) {
ctx.ReplySuccess($"Hello {ctx.Sender.Name}!");
}
[Command("info", Language.English, description: "Get player info")]
[CommandAlias("informação", Language.Portuguese, description: "Obter informações do jogador")]
public static void InfoCommand(CommandContext ctx, PlayerData player) {
ctx.ReplySuccess($"Player: {player.Name}, Level: {player.Level}");
}
}
*/
}