egebilecen / PZServerDiscordBot

A Project Zomboid Discord Bot written in C# using Discord.NET to manage and execute commands on Project Zomboid Server.
GNU General Public License v3.0
61 stars 11 forks source link

Bug with !add_workshop_mod #98

Closed SerRipsen closed 7 months ago

SerRipsen commented 9 months ago

Hey, I've run into a very strange bug whilst using this tool. When doing !add or !remove_workshop_mod, there appears to be a strange cache of 8 or so mods that are stuck in the system. I'll try to explain what's happening concisely.

I have a bunch of mods that seem to appear no matter what I do. This output below is contiguous, I have added spaces to denote each individual command.

The discord commands I used are the full commands with the links, I'm just abbreviating here for human reading.

The commands are; !add "TakeAnyAmount" !remove "MinimalDisplayBars;ScrapArmor(new version);ScrapGuns(new version);ScrapWeapons(new version);BetterExerciseEasy;CombatText" !add "TakeAnyAmount"

The important information to note here: When using !add "TakeAnyAmount" the first time, I had gone to the server.ini file and deleted ALL mods and workshop IDs. The starting server.ini file is empty. When using !remove for the list of items, it clearly shows these are all successfully removed. When using !add "TakeAnyAmount" for the second time, all those items have come back again.

Just to be plain here, if I choose to !remove half the mods, then !remove the other half, the second command's output will show the first half of the mods in the list again. It's like there is some sort of cache remembering the mods and bringing them back.

I have done several !stop_server and !restart_server to see if this resolves and no luck.

LOG  : General     , 1694978065228> 21,387,128> command entered via server console (System.in): "changeoption Mods "MinimalDisplayBars;VISIBLE_BACKPACK_BACKGROUND;ScrapArmor(new version);ScrapGuns(new version);ScrapWeapons(new version);BetterExerciseEasy;CombatText;TakeAnyAmount""
LOG  : General     , 1694978065229> 21,387,128> command entered via server console (System.in): "changeoption WorkshopItems "2004998206;2808679062;2710990739;2658619264;2125659488;2122265954;2286124931;2985394645""
LOG  : General     , 1694978065247> 21,387,146> writing C:\Users\[user]\Zomboid\Server\[server].ini
LOG  : General     , 1694978065254> 21,387,153> Option : Mods is now : MinimalDisplayBars;VISIBLE_BACKPACK_BACKGROUND;ScrapArmor(new version);ScrapGuns(new version);ScrapWeapons(new version);BetterExerciseEasy;CombatText;TakeAnyAmount
LOG  : General     , 1694978065255> 21,387,154> writing C:\Users\[user]\Zomboid\Server\[server].ini
LOG  : General     , 1694978065262> 21,387,161> Option : WorkshopItems is now : 2004998206;2808679062;2710990739;2658619264;2125659488;2122265954;2286124931;2985394645

LOG  : General     , 1694978100797> 21,422,697> command entered via server console (System.in): "changeoption Mods "VISIBLE_BACKPACK_BACKGROUND""
LOG  : General     , 1694978100798> 21,422,697> command entered via server console (System.in): "changeoption WorkshopItems "2808679062""
LOG  : General     , 1694978100845> 21,422,745> writing C:\Users\[user]\Zomboid\Server\[server].ini
LOG  : General     , 1694978100851> 21,422,751> Option : Mods is now : VISIBLE_BACKPACK_BACKGROUND
LOG  : General     , 1694978100852> 21,422,751> writing C:\Users\[user]\Zomboid\Server\[server].ini
LOG  : General     , 1694978100857> 21,422,757> Option : WorkshopItems is now : 2808679062

LOG  : General     , 1694978110906> 21,432,806> command entered via server console (System.in): "changeoption Mods "MinimalDisplayBars;VISIBLE_BACKPACK_BACKGROUND;ScrapArmor(new version);ScrapGuns(new version);ScrapWeapons(new version);BetterExerciseEasy;CombatText;TakeAnyAmount""
LOG  : General     , 1694978110907> 21,432,806> command entered via server console (System.in): "changeoption WorkshopItems "2004998206;2808679062;2710990739;2658619264;2125659488;2122265954;2286124931;2985394645""
LOG  : General     , 1694978110949> 21,432,849> writing C:\Users\[user]\Zomboid\Server\[server].ini
LOG  : General     , 1694978110955> 21,432,855> Option : Mods is now : MinimalDisplayBars;VISIBLE_BACKPACK_BACKGROUND;ScrapArmor(new version);ScrapGuns(new version);ScrapWeapons(new version);BetterExerciseEasy;CombatText;TakeAnyAmount
LOG  : General     , 1694978110956> 21,432,855> writing C:\Users\[user]\Zomboid\Server\[server].ini
LOG  : General     , 1694978110961> 21,432,861> Option : WorkshopItems is now : 2004998206;2808679062;2710990739;2658619264;2125659488;2122265954;2286124931;2985394645
egebilecen commented 9 months ago

Thanks for the heads up!

@DomicidalDesigns, could you look into this?

SerRipsen commented 9 months ago

I have also removed the files for the program and redownloaded the latest release to be sure the files I'm using are not edited in any way, and I still have the same effect. I checked the output logs for the feature and it only seems to show the Add commands in the logs, not the Remove commands. However, the Remove commands do work, if I run a single set of Remove and then restart the server, it will correctly update the .ini file. Then after booting, running any command introduces the issue again. Very confused!

egebilecen commented 7 months ago

I am closing this issue as there have been no update for a long time.