Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion EXILED/EXILED.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<PropertyGroup>
<!-- This is the global version and is used for all projects that don't have a version -->
<Version Condition="$(Version) == ''">9.13.3</Version>
<Version Condition="$(Version) == ''">9.14.0</Version>
<!-- Enables public beta warning via the PUBLIC_BETA constant -->
<PublicBeta>false</PublicBeta>

Expand Down
23 changes: 19 additions & 4 deletions EXILED/Exiled.Events/Handlers/Internal/ClientStarted.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public static void OnClientStarted()
{
PrefabType prefabType = EnumUtils<PrefabType>.Values[i];
PrefabAttribute attribute = prefabType.GetPrefabAttribute();
Log.Info($"{prefabType} {attribute.AssetId}/{attribute.Name}");
if (prefabs.TryGetValue(attribute.AssetId, out (GameObject, Component) tuple))
{
if (attribute.Name != tuple.Item1.name)
Expand All @@ -76,13 +77,13 @@ public static void OnClientStarted()
continue;
}

KeyValuePair<uint, (GameObject, Component)>? value = prefabs.FirstOrDefault(x => x.Value.Item1.name == attribute.Name);
if (value.HasValue)
if (TryGet(attribute.Name, out KeyValuePair<uint, (GameObject, Component)> value))
{
Log.Warn($"Not valid AssetId {prefabType}: {attribute.Name} ({attribute.AssetId}) -> {value.Value.Value.Item1.name} ({value.Value.Key})");
Log.Error($"{prefabType} {value}");
Log.Warn($"Not valid AssetId {prefabType}: {attribute.Name} ({attribute.AssetId}) -> {value.Value.Item1.name} ({value.Key})");

PrefabHelper.Prefabs.Add(prefabType, prefabs.FirstOrDefault(prefab => prefab.Key == attribute.AssetId || prefab.Value.Item1.name.Contains(attribute.Name)).Value);
prefabs.Remove(value.Value.Key);
prefabs.Remove(value.Key);
continue;
}

Expand All @@ -91,6 +92,20 @@ public static void OnClientStarted()

foreach (KeyValuePair<uint, (GameObject, Component)> missing in prefabs)
Log.Warn($"Missing prefab in {nameof(PrefabType)}: {missing.Value.Item1.name} ({missing.Key})");

return;

bool TryGet(string name, out KeyValuePair<uint, (GameObject, Component)> tuple)
{
foreach (KeyValuePair<uint, (GameObject, Component)> kvp in prefabs.Where(kvp => kvp.Value.Item1.name == name))
{
tuple = kvp;
return true;
}

tuple = default;
return false;
}
}
}
}
Loading