66 lines
No EOL
2 KiB
C#
66 lines
No EOL
2 KiB
C#
using LibAC.NBT;
|
|
|
|
namespace ForgeCoreAPI;
|
|
|
|
public interface IPlugin
|
|
{
|
|
/// <summary>
|
|
/// Called on plugin load.
|
|
/// <br/>
|
|
/// DOES NOT INDICATE PLUGIN ENABLE / START
|
|
/// </summary>
|
|
void Initialize();
|
|
|
|
/// <summary>
|
|
/// Called when the plugin is enabled by the server
|
|
/// </summary>
|
|
void Enable();
|
|
|
|
/// <summary>
|
|
/// Called when the plugin is disabled by the server.
|
|
///<br/>
|
|
/// NOTE: This action also indicates the plugin will no longer receive calls to the tick method.
|
|
/// </summary>
|
|
void Disable();
|
|
|
|
/// <summary>
|
|
/// Called every 5 seconds by the master server
|
|
/// </summary>
|
|
void tick();
|
|
|
|
/// <summary>
|
|
/// Called when the server is starting the shutdown process. This operation cannot be aborted, all plugin tasks should be immediately stopped. SaveConfig will follow this instruction.
|
|
/// </summary>
|
|
void TearDown();
|
|
|
|
/// <summary>
|
|
/// Provides the plugin with a copy of its saved configuration data
|
|
/// </summary>
|
|
/// <param name="config">A final readonly configuration object</param>
|
|
void LoadConfig(CompoundTag config);
|
|
|
|
/// <summary>
|
|
/// Requested by the master server when the state is being saved. This does not indicate shutdown of the server.
|
|
/// </summary>
|
|
/// <returns>A serialized copy of the plugin configuration data. This should include all settings and data.</returns>
|
|
CompoundTag SaveConfig();
|
|
|
|
/// <summary>
|
|
/// This is called when no plugin memory exists, or when a reset has been called for this plugin.
|
|
/// </summary>
|
|
void ResetMemory();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Marks a class as a valid plugin. Plugin Class must also implement IPlugin
|
|
/// </summary>
|
|
public class ForgeCorePluginAttribute : Attribute
|
|
{
|
|
public string pluginName;
|
|
public bool providesShutdownMethod = false;
|
|
public ForgeCorePluginAttribute(string PluginName, bool ProvidesShutdownMethod = false)
|
|
{
|
|
this.pluginName = PluginName;
|
|
this.providesShutdownMethod = ProvidesShutdownMethod;
|
|
}
|
|
} |