diff --git a/Plugin.cs b/Plugin.cs index 6cb4ab4..a22c345 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -1,16 +1,28 @@ -using Rocket.Core.Plugins; +using Rocket.Core.Logging; +using Rocket.Core.Plugins; +using Rocket.Unturned.Chat; +using SDG.Unturned; +using System; namespace UnturnedExamplePlugin { public class Plugin : RocketPlugin { + public static Plugin Instance { get; private set; } // Your plugin variable + public UnityEngine.Color MessageColor { get; private set; } // Message color variable + public Random Random { get; private set; } // Randomizer variable + protected override void Load() { - // Enter code for load + Instance = this; // Link plugin and make this public + MessageColor = UnturnedChat.GetColorFromName(Configuration.Instance.MessageColor, UnityEngine.Color.black); // Get message color from config + Random = new Random(); // Create and set new Random object for use later in plugin + Logger.Log(Configuration.Instance.LoadMessage); // Log load message with Rocket + CommandWindow.Log($"{Name} {Assembly.GetName().Version} has been loaded!"); // Log loading info with Unturned SDG (without Rocket or other loaders) } protected override void Unload() { - // Enter code for unload + CommandWindow.LogWarning($"{Name} {Assembly.GetName().Version} has been unloaded!"); // Log warning unloading info with Unturned SDG } } } diff --git a/PluginConfiguration.cs b/PluginConfiguration.cs index f2f13f4..bb78f37 100644 --- a/PluginConfiguration.cs +++ b/PluginConfiguration.cs @@ -4,9 +4,12 @@ namespace UnturnedExamplePlugin { public class PluginConfiguration : IRocketPluginConfiguration { + public string MessageColor { get; set; } + public string LoadMessage { get; set; } public void LoadDefaults() { - // Enter config code + MessageColor = "green"; + LoadMessage = "Example Plugin is active!\nGet more plugins on https://vk.com/astis.unturned.store"; } } }