mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-11-14 10:45:23 +01:00
Fix plugin not starting without PCGF PluginLib
This commit is contained in:
parent
a165ca9531
commit
2acff3673a
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020 GeorgH93
|
* Copyright (C) 2022 GeorgH93
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -36,6 +36,7 @@ public class MinepacksBadRabbit extends BadRabbit
|
|||||||
{
|
{
|
||||||
JavaPlugin newPluginInstance = null;
|
JavaPlugin newPluginInstance = null;
|
||||||
Plugin pcgfPluginLib = Bukkit.getPluginManager().getPlugin("PCGF_PluginLib");
|
Plugin pcgfPluginLib = Bukkit.getPluginManager().getPlugin("PCGF_PluginLib");
|
||||||
|
boolean standalone = true;
|
||||||
if(pcgfPluginLib != null)
|
if(pcgfPluginLib != null)
|
||||||
{
|
{
|
||||||
if(new Version(pcgfPluginLib.getDescription().getVersion()).olderThan(new Version(MagicValues.MIN_PCGF_PLUGIN_LIB_VERSION)))
|
if(new Version(pcgfPluginLib.getDescription().getVersion()).olderThan(new Version(MagicValues.MIN_PCGF_PLUGIN_LIB_VERSION)))
|
||||||
@ -45,18 +46,22 @@ public class MinepacksBadRabbit extends BadRabbit
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
getLogger().info("PCGF-PluginLib installed. Switching to normal mode!");
|
getLogger().info("PCGF-PluginLib installed. Switching to normal mode!");
|
||||||
newPluginInstance = new Minepacks();
|
standalone = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
getLogger().info("PCGF-PluginLib not installed. Switching to standalone mode!");
|
getLogger().info("PCGF-PluginLib not installed. Switching to standalone mode!");
|
||||||
}
|
}
|
||||||
if(newPluginInstance == null)
|
if(standalone)
|
||||||
{
|
{
|
||||||
Class<?> standaloneClass = Class.forName("at.pcgamingfreaks.MinepacksStandalone.Bukkit.Minepacks");
|
Class<?> standaloneClass = Class.forName("at.pcgamingfreaks.MinepacksStandalone.Bukkit.Minepacks");
|
||||||
newPluginInstance = (JavaPlugin) standaloneClass.newInstance();
|
return (JavaPlugin) standaloneClass.newInstance();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Class<?> normalClass = Class.forName("at.pcgamingfreaks.Minepacks.Bukkit.Minepacks");
|
||||||
|
return (JavaPlugin) normalClass.newInstance();
|
||||||
}
|
}
|
||||||
return newPluginInstance;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
2
pom.xml
2
pom.xml
@ -7,7 +7,7 @@
|
|||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>2.4.5</revision>
|
<revision>2.4.5.1</revision>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user