Skip to content

Commit

Permalink
autommatically find exiled version (#2154)
Browse files Browse the repository at this point in the history
* autommatically find exiled version

* Update Loader.cs

---------

Co-authored-by: Thunder <thundermaker300@gmail.com>
  • Loading branch information
louis1706 and Thundermaker300 authored May 21, 2024
1 parent e79eeeb commit e1ec158
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Exiled.Loader/Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public static IPlugin<IConfig> CreatePlugin(Assembly assembly)

Log.Debug($"Instantiated type {type.FullName}");

if (CheckPluginRequiredExiledVersion(plugin))
if (CheckPluginRequiredExiledVersion(plugin, assembly.GetReferencedAssemblies()?.FirstOrDefault(x => x?.Name is "Exiled.Loader")?.Version ?? new()))
continue;

if (defaultPlayerClass is not null)
Expand Down Expand Up @@ -423,12 +423,12 @@ private static bool IsDerivedFromPlugin(Type type)
return false;
}

private static bool CheckPluginRequiredExiledVersion(IPlugin<IConfig> plugin)
private static bool CheckPluginRequiredExiledVersion(IPlugin<IConfig> plugin, Version pluginVersion)
{
if (plugin.IgnoreRequiredVersionCheck)
return false;

Version requiredVersion = plugin.RequiredExiledVersion;
Version requiredVersion = plugin.RequiredExiledVersion == default ? pluginVersion : plugin.RequiredExiledVersion;
Version actualVersion = Version;

// Check Major version
Expand Down

0 comments on commit e1ec158

Please sign in to comment.