Add plugin lib version check

This commit is contained in:
GeorgH93 2023-02-22 23:45:28 +01:00
parent 4d111eca9d
commit 509b93ce2e
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
2 changed files with 18 additions and 8 deletions

View File

@ -38,6 +38,12 @@
<version>1.19.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>at.pcgamingfreaks</groupId>
<artifactId>Minepacks-MagicValues</artifactId>
<version>${version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>

View File

@ -17,6 +17,10 @@
package at.pcgamingfreaks.Minepacks.Paper;
import at.pcgamingfreaks.Minepacks.MagicValues;
import at.pcgamingfreaks.PCGF_PluginLibVersionDetection;
import at.pcgamingfreaks.Version;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
@ -78,21 +82,21 @@ private boolean patchPluginMeta(final @NotNull PluginProviderContext context)
private boolean checkPcgfPluginLib(final @NotNull PluginProviderContext context)
{
try
String version = PCGF_PluginLibVersionDetection.getVersionBukkit();
if (version != null)
{
Class.forName("at.pcgamingfreaks.PluginLib.Bukkit.PluginLib");
//if (new Version(pcgfPluginLib.getDescription().getVersion()).olderThan(new Version(MagicValues.MIN_PCGF_PLUGIN_LIB_VERSION)))
if (true) // TODO check version
if (new Version(version).olderThan(new Version(MagicValues.MIN_PCGF_PLUGIN_LIB_VERSION)))
{
context.getLogger().info("PCGF-PluginLib installed. Switching to normal mode!");
context.getLogger().info("PCGF-PluginLib to old! Switching to standalone mode!");
return true;
}
else
{
context.getLogger().info("PCGF-PluginLib to old! Switching to standalone mode!");
context.getLogger().info("PCGF-PluginLib installed. Switching to normal mode!");
}
return true;
}
catch(ClassNotFoundException ignored)
else
{
context.getLogger().info("PCGF-PluginLib not installed. Switching to standalone mode!");
}