summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMat <mail@mathias.is>2020-03-27 13:47:04 +0100
committerGitHub <noreply@github.com>2020-03-27 13:47:04 +0100
commit7d8da81b92f0a9dcd7ae35628d3896ca565a9b45 (patch)
tree889e45a1fd8eb8b90b40cf0a083478041cc30146
parent Lock hopper when powered by redstone (#4347) (diff)
downloadcuberite-7d8da81b92f0a9dcd7ae35628d3896ca565a9b45.tar
cuberite-7d8da81b92f0a9dcd7ae35628d3896ca565a9b45.tar.gz
cuberite-7d8da81b92f0a9dcd7ae35628d3896ca565a9b45.tar.bz2
cuberite-7d8da81b92f0a9dcd7ae35628d3896ca565a9b45.tar.lz
cuberite-7d8da81b92f0a9dcd7ae35628d3896ca565a9b45.tar.xz
cuberite-7d8da81b92f0a9dcd7ae35628d3896ca565a9b45.tar.zst
cuberite-7d8da81b92f0a9dcd7ae35628d3896ca565a9b45.zip
-rw-r--r--src/Bindings/PluginManager.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp
index 13039f834..b57f3779f 100644
--- a/src/Bindings/PluginManager.cpp
+++ b/src/Bindings/PluginManager.cpp
@@ -154,8 +154,9 @@ void cPluginManager::ReloadPluginsNow(cSettingsRepositoryInterface & a_Settings)
void cPluginManager::InsertDefaultPlugins(cSettingsRepositoryInterface & a_Settings)
{
a_Settings.AddKeyName("Plugins");
- a_Settings.AddValue("Plugins", "Plugin", "Core");
- a_Settings.AddValue("Plugins", "Plugin", "ChatLog");
+ a_Settings.AddValue("Plugins", "Core", "1");
+ a_Settings.AddValue("Plugins", "ChatLog", "1");
+ a_Settings.AddValue("Plugins", "ProtectionAreas", "0");
}
@@ -1733,22 +1734,40 @@ AStringVector cPluginManager::GetFoldersToLoad(cSettingsRepositoryInterface & a_
InsertDefaultPlugins(a_Settings);
}
- // Get the list of plugins to load:
AStringVector res;
- auto Values = a_Settings.GetValues("Plugins");
- for (auto NameValue : Values)
+
+ // Get the old format plugin list, and migrate it.
+ // Upgrade path added on 2020-03-27
+ auto OldValues = a_Settings.GetValues("Plugins");
+ for (auto NameValue : OldValues)
{
AString ValueName = NameValue.first;
if (ValueName.compare("Plugin") == 0)
{
AString PluginFile = NameValue.second;
- if (!PluginFile.empty())
+ if (
+ !PluginFile.empty() &&
+ (PluginFile != "0") &&
+ (PluginFile != "1")
+ )
{
- res.push_back(PluginFile);
+ a_Settings.DeleteValue("Plugins", ValueName);
+ a_Settings.SetValue("Plugins", PluginFile, "1");
}
}
} // for i - ini values
+ // Get the list of plugins to load:
+ auto Values = a_Settings.GetValues("Plugins");
+ for (auto NameValue : Values)
+ {
+ AString Enabled = NameValue.second;
+ if (Enabled == "1")
+ {
+ res.push_back(NameValue.first);
+ }
+ } // for i - ini values
+
return res;
}