Skip to content
This repository was archived by the owner on Aug 5, 2025. It is now read-only.

Commit e1da3df

Browse files
committed
- fix: Sometimes on mapchange arenas not found (thanks for the feedback nyshun.)
1 parent 7bcfa7e commit e1da3df

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
-- 2025.05.21 - 2.0.6
2+
3+
- fix: Sometimes on mapchange arenas not found (thanks for the feedback nyshun.)
4+
15
-- 2025.05.16 - 2.0.5
26

37
- feat: Added 3 new natives - IsAFK, FindOpponents & TerminateRoundIfPossible

src-plugin/Plugin/Models/ArenaFinder.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,18 @@ public List<Tuple<List<SpawnPoint>, List<SpawnPoint>>> GetArenaPairs()
5555

5656
Plugin.Logger.LogInformation("Successfully setup {0} arena(s) on map {1}!", spawns.Count, Server.MapName);
5757

58-
var maxPairSize = spawns
59-
.Select(pair => Math.Min(pair.Item1.Count, pair.Item2.Count))
60-
.Max();
58+
if (spawns.Count > 0)
59+
{
60+
var maxPairSize = spawns
61+
.Select(pair => Math.Min(pair.Item1.Count, pair.Item2.Count))
62+
.Max();
6163

62-
Plugin.Logger.LogInformation("Supported arena modes: {0}", maxPairSize > 1 ? $"1v1-{maxPairSize}v{maxPairSize}" : "1v1");
64+
Plugin.Logger.LogInformation("Supported arena modes: {0}", maxPairSize > 1 ? $"1v1-{maxPairSize}v{maxPairSize}" : "1v1");
65+
}
66+
else
67+
{
68+
Plugin.Logger.LogWarning("No arenas were created. Players will not be able to spawn.");
69+
}
6370
return spawns;
6471
}
6572

@@ -236,6 +243,14 @@ public List<Tuple<List<SpawnPoint>, List<SpawnPoint>>> GetSpawnPairsUsingEnemyPa
236243
}
237244
}
238245

246+
// Fallback: if no valid arenas were found, create a single arena with all spawns
247+
if (arenaPairs.Count == 0 && ctList.Count > 0 && tList.Count > 0)
248+
{
249+
Plugin.Logger.LogWarning("No suitable arenas found with standard clustering. Using fallback mode with all spawns.");
250+
arenaPairs.Add(Tuple.Create(ctList, tList));
251+
Plugin.Logger.LogDebug($"Fallback Arena: CT Spawns: {ctList.Count}, T Spawns: {tList.Count}.");
252+
}
253+
239254
return arenaPairs;
240255
}
241256

src-plugin/Plugin/PluginManifest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public sealed partial class Plugin : BasePlugin
1010

1111
public override string ModuleAuthor => "K4ryuu";
1212

13-
public override string ModuleVersion => "2.0.5 " +
13+
public override string ModuleVersion => "2.0.6 " +
1414
#if RELEASE
1515
"(release)";
1616
#else

0 commit comments

Comments
 (0)