diff --git a/MCServer/Plugins/Core/web_serversettings.lua b/MCServer/Plugins/Core/web_serversettings.lua index 4e4901f4c..4f33f53ff 100644 --- a/MCServer/Plugins/Core/web_serversettings.lua +++ b/MCServer/Plugins/Core/web_serversettings.lua @@ -1,5 +1,3 @@ -local CurrentlyEditingIni = nil - -- Some HTML helper functions local function HTML_Option( value, text, selected ) if( selected == true ) then @@ -68,9 +66,9 @@ local function ShowGeneralSettings( Request ) Content = Content .. "
Monsters Settings
" + local Content = "" + local InfoMsg = nil + + local SettingsIni = cIniFile("settings.ini") + if( SettingsIni:ReadFile() == false ) then + InfoMsg = "ERROR: Could not read settings.ini!" + end + + if( Request.PostParams["monsters_submit"] ~= nil ) then + + if( tonumber( Request.PostParams["Monsters_AnimalsOn"] ) ~= nil ) then + SettingsIni:SetValue("Monsters", "AnimalsOn", Request.PostParams["Monsters_AnimalsOn"], false ) + end + if( tonumber( Request.PostParams["Monsters_AnimalSpawnInterval"] ) ~= nil ) then + SettingsIni:SetValue("Monsters", "AnimalSpawnInterval", Request.PostParams["Monsters_AnimalSpawnInterval"], false ) + end + SettingsIni:SetValue("Monsters", "Types", Request.PostParams["Monsters_Types"], false ) + if( SettingsIni:WriteFile() == false ) then + InfoMsg = "ERROR: Could not write to settings.ini!" + else + InfoMsg = "INFO: Successfully saved changes to settings.ini" + end + end + + + Content = Content .. "" + + return Content end local function ShowWorldsSettings( Request )