Sorry, we don't support your browser.  Install a modern browser

Improvements for PluginReferenceAttribute and making life easier for developers#13

Enhanced PluginReferenceAttribute Proposal

I propose refining the PluginReferenceAttribute by extending its functionalities in the following ways:

1. Introducing Minimum Version Requirement:

  • Functionality:
    • Allow the specification of a minimum version of the dependent plugin when utilizing the attribute.
  • Consequence:
    • If the installed plugin has a version below the specified one, the parent plugin should be automatically disabled.
  • User Feedback:
    • Generate an informative message for the user. This message should detail that the version of the dependent plugin doesn’t meet the required standards.

2. Mandatory Plugin Requirement:

  • New Argument:
    • Incorporate a third bool argument in the attribute, determining whether the dependent plugin is mandatory for the parent plugin’s operation.
  • Behavior if True:
    • If this argument is set to true and the dependent plugin is either missing or its version doesn’t meet the requirements, the parent plugin should be disabled.
  • Behavior if False:
    • If the argument is set to false, the parent plugin can continue to operate, albeit with limited functionality. Additionally, a warning should indicate that certain features might not function correctly due to the absence of the dependent plugin.
using System;

namespace Oxide.Plugins
    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
    public class PluginReferenceAttribute : Attribute
        public string Name { get; }
        public string MinimumVersion { get; }
        public bool IsRequired { get; }

        public PluginReferenceAttribute(string name, string minimumVersion = null, bool isRequired = false)
            Name = name;
            MinimumVersion = minimumVersion;
            IsRequired = isRequired;

[PluginReference(“CopyPaste”, “1.2.3”, true)] // here “true” indicates that the plugin is required
[PluginReference(“ImageLibrary”, “2.0.1”)]
[PluginReference(“IQChat”, “1.0.0”, false)] // here “false” indicates that the plugin is not required
Plugin CopyPaste, ImageLibrary, IQChat;

7 months ago