Skip to content

Commit

Permalink
* Buildable changes, var base
Browse files Browse the repository at this point in the history
+ Add variables
+ Add example basic logic
  • Loading branch information
vse3211 committed Jun 30, 2022
1 parent ea04721 commit b6368cd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
18 changes: 15 additions & 3 deletions Plugin.cs
Original file line number Diff line number Diff line change
@@ -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<PluginConfiguration>
{
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
}
}
}
5 changes: 4 additions & 1 deletion PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
}

0 comments on commit b6368cd

Please sign in to comment.