Skip to content

Commit

Permalink
Fix plugin not starting without PCGF PluginLib
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgH93 committed Mar 4, 2022
1 parent a165ca9 commit 2acff36
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 GeorgH93
* Copyright (C) 2022 GeorgH93
*
* 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
Expand Down Expand Up @@ -36,6 +36,7 @@ public class MinepacksBadRabbit extends BadRabbit
{
JavaPlugin newPluginInstance = null;
Plugin pcgfPluginLib = Bukkit.getPluginManager().getPlugin("PCGF_PluginLib");
boolean standalone = true;
if(pcgfPluginLib != null)
{
if(new Version(pcgfPluginLib.getDescription().getVersion()).olderThan(new Version(MagicValues.MIN_PCGF_PLUGIN_LIB_VERSION)))
Expand All @@ -45,18 +46,22 @@ public class MinepacksBadRabbit extends BadRabbit
else
{
getLogger().info("PCGF-PluginLib installed. Switching to normal mode!");
newPluginInstance = new Minepacks();
standalone = false;
}
}
else
{
getLogger().info("PCGF-PluginLib not installed. Switching to standalone mode!");
}
if(newPluginInstance == null)
if(standalone)
{
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 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<packaging>pom</packaging>

<properties>
<revision>2.4.5</revision>
<revision>2.4.5.1</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

Expand Down

0 comments on commit 2acff36

Please sign in to comment.