You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Proposed change is to set the Plugin#RequiredApiVersion using LabApiProperties.CompiledVersion in the base class and change the member from abstract to virtual. This will still allow developers to change the version if they prefer, but will not be a required override.
It's 1 less boilerplate step for making new plugins.
Unfortunately, this change is not viable. At the moment, CompiledVersion is not a const, so it does nothing. If it was a const, this would get evaluated at LabAPI's compile time, not at the plugin's compile time.
Unfortunately, this change is not viable. At the moment, CompiledVersion is not a const, so it does nothing. If it was a const, this would get evaluated at LabAPI's compile time, not at the plugin's compile time.
(I misread your original comment, but the runtime result is still the same)
I was looking into that and noticed, CompiledVersion is static readonly, not const. So it will be evaluated at runtime with the latest version, not compile time. I expect this is not desired behaviour but the decompiled API and plugin both show it's calculating on runtime, not a baked string.
I'll take a minute later to confirm on a server.
RequiredApiVersion in the Plugin class would need to be a const to keep its compile time version. Changing from abstract to virtual doesn't change the behaviour of the current calculated version, it will always be the runtime version of LabAPI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Small change for consideration.
Usually a plugin is made for the LabAPI version it's built with. This can be found in the LabAPI plugin example as well https://github.com/northwood-studios/LabAPI/wiki/Writing-Your-First-Plugin.
Proposed change is to set the
Plugin#RequiredApiVersionusingLabApiProperties.CompiledVersionin the base class and change the member fromabstracttovirtual. This will still allow developers to change the version if they prefer, but will not be a required override.It's 1 less boilerplate step for making new plugins.