Handle exceptions when generating spawners as pattern may match non-spawner files (#186)

This commit is contained in:
Jabin 2020-07-28 02:15:29 +10:00 committed by GitHub
parent 21b02a7508
commit df53c16620
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -42,8 +42,16 @@ namespace Server.Engines.Spawners
{
var file = files[i];
from.SendMessage("GenerateSpawners: Generating spawners for {0}...", file.Name);
List<DynamicJson> spawners = JsonConfig.Deserialize<List<DynamicJson>>(file.FullName);
ParseSpawnerList(from, spawners, options);
try
{
var spawners = JsonConfig.Deserialize<List<DynamicJson>>(file.FullName);
ParseSpawnerList(from, spawners, options);
}
catch (JsonException)
{
from.SendMessage("GenerateSpawners: Exception parsing {0}, file may not be in the correct format.", file.FullName);
}
}
}