mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-14 01:04:12 +00:00
Add API to query for plugin enabled/disabled status
This commit is contained in:
1 parent
3aad454237
commit
31e4d93e33
2 files changed
+9
-6
No files matched your search
@@ -16,6 +16,7 @@ import com.google.common.collect.Lists;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
@@ -37,6 +38,7 @@ import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.Forestry;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.interfaces.IOreDictionaryHandler;
|
||||
import forestry.core.interfaces.IPickupHandler;
|
||||
import forestry.core.interfaces.IResupplyHandler;
|
||||
@@ -114,7 +116,7 @@ public class PluginManager {
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return isModuleLoaded(this);
|
||||
return ForestryAPI.enabledPlugins.contains(toString());
|
||||
}
|
||||
|
||||
public boolean canBeDisabled() {
|
||||
@@ -137,10 +139,6 @@ public class PluginManager {
|
||||
return EnumSet.copyOf(loadedModules);
|
||||
}
|
||||
|
||||
public static boolean isModuleLoaded(Module module) {
|
||||
return loadedModules.contains(module);
|
||||
}
|
||||
|
||||
private static void registerHandlers(ForestryPlugin plugin) {
|
||||
Proxies.log.fine("Registering Handlers for Plugin: {0}", plugin);
|
||||
|
||||
@@ -229,6 +227,11 @@ public class PluginManager {
|
||||
unloadedModules.removeAll(toLoad);
|
||||
loadedModules.addAll(toLoad);
|
||||
|
||||
ForestryAPI.enabledPlugins = new HashSet<String>();
|
||||
for (Module m : loadedModules) {
|
||||
ForestryAPI.enabledPlugins.add(m.toString());
|
||||
}
|
||||
|
||||
if (config.hasChanged()) {
|
||||
config.save();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user