# Updating Mods

## Updating Mods

With version 220304 of the Stardew Valley Mod Manager we introduced a new utility, the Mod Update Check Tool (Beta). This tool is a very early implementation that is partially conceptual, however depending on the mod configuration - this can actually be used to check the current version of a mod and compare it to the latest version available on online.

### **Pre-Requisites**

It is important to note that this utility will not work with all mods, as it currently operates in a way that looks for very specific (but also widely used) configuration setups. The following need to be met for a mod to work with this tool:

* The mod you are checking must have a `manifest.json` file in the root directory.
* The mod must be in the disabled mods list.
* The `manifest.json` file must contain a Nexus Mods update key (configured as: `"UpdateKeys": [ "Nexus:####" ]` where the `#` includes your numerical update key for NexusMods.
* The `manifest.json` file must contain a version number that is formatted in the same format as your Nexus website listing.
* The `manifest.json` file must not contain multiple update keys or update keys for other services.

The following is an example of a good `manifest.json` that is located at the root directory:

```
{
    "Name": "My Awesome Mod",
    "Author": "RWE Labs",
    "Version": "1.24.8",
    "MinimumApiVersion": "3.14.0",
    "Description": "A really cool mod for demonstration purposes.",
    "UniqueID": "RWELabs.AwesomeMod",
    "EntryDll": "AwesomeMod.dll",
    "UpdateKeys": [ "Nexus:1234" ]
}
```

### Check for Updates

* [ ] To check a mod for updates, ensure that the mod is disabled (as the ability to check enabled mods for updates is a feature planned for the future but is not yet supported or implemented) and click "Check for Mod Updates \[Beta]" from the Mod Management menu.

![The location of the "Check for Mod Updates" button in Stardew Valley Mod Managers v220501L and earlier.](https://user-images.githubusercontent.com/69621127/160754123-8b3bc68c-b6fa-4141-9cec-e7f0e1d91125.png)

* [ ] You should see a window with a dropdown box, a button and an output console. It should look like the following:

![The Update Check utility showing that it is ready to check for updates.](https://user-images.githubusercontent.com/69621127/160754273-2ffb1e3e-f066-4220-8553-3c74d2f458ad.png)

* [ ] Select one of your *disabled* mods from the dropdown list, that you wish to check the status of. Once you have selected a mod from the list, click on the "Check for Updates" button.
* [ ] If the mod is correctly formatted, it should inform you of the mod's current version and it's update key value. It will then attempt to connect to NexusMods to retrieve the latest version. If the current version is equal to the latest version on NexusMods, the output will read:

```
There are no updates available
This mod is up to date
```

![The Update Check utility showing that the mod is up to date.](https://user-images.githubusercontent.com/69621127/160754495-77b12fe2-7114-4bba-81f8-63bde69eff91.png)

* [ ] If the mod is not configured correctly, (e.g. having multiple update keys or update keys for a different service), the output will read:

```
Update Key or Manifest not found.
This mod may not be correctly configured or may not support updates via supported update services
```

![The Update Check utility showing that a mod could not be queried for updates.](https://user-images.githubusercontent.com/69621127/160754663-b5833a01-4068-46bc-8351-0ac2d643f81f.png)

* [ ] If the mod is configured correctly and there is an update available, a popup will appear stating that there is an update available. The user can click "Yes" and a link to the mod will open in the user's default browser, where the latest version can be downloaded and installed via the Mod Manager. The output will read:

```
There are updates available
Presenting popup for download
```

![The Update Check utility showing a prompt to download an available update.](https://user-images.githubusercontent.com/69621127/160754895-5af2efab-2940-4c9c-aa1f-b99e51101731.png)

### **Downloading the Mod Updates**

Downloading mod updates is done manually, via the NexusMods website. The Mod Update Check tool will allow you to open the link to the mod in the browser when an update is found, however a NexusMods account will be required to download the mod from the website. It will need to be installed via the "Install Mods" menu in the Mod Management tab after the user has downloaded the ZIP file.

<br>
