@@ -17,33 +17,10 @@ public class Core : BasePlugin
1717 public static Core Plugin = null ! ;
1818
1919 public override string ModuleName => "[Retakes] Weapons Allocator" ;
20- public override string ModuleVersion => "1.0.4 " ;
20+ public override string ModuleVersion => "1.0.5 " ;
2121 public override string ModuleAuthor => "Ravid & B3none" ;
2222 public override string ModuleDescription => "Weapons Allocator plugin for retakes" ;
2323
24- private static CCSGameRules ? _gameRules ;
25-
26- private static void SetGameRules ( )
27- {
28- var gameRulesEntities = Utilities . FindAllEntitiesByDesignerName < CCSGameRulesProxy > ( "cs_gamerules" ) ;
29-
30- if ( gameRulesEntities . Any ( ) )
31- {
32- _gameRules = gameRulesEntities . First ( ) . GameRules ! ;
33- }
34- }
35-
36- private static bool WarmupRunning
37- {
38- get
39- {
40- if ( _gameRules is null )
41- SetGameRules ( ) ;
42-
43- return _gameRules is not null && _gameRules . WarmupPeriod ;
44- }
45- }
46-
4724 public static Config Config = null ! ;
4825
4926 public static Database Db = null ! ;
@@ -77,9 +54,18 @@ public override void Unload(bool hotReload)
7754 Utilities . GetPlayers ( ) . ForEach ( RemovePlayerFromList ) ;
7855 }
7956
80- public static bool IsLive ( )
57+ public static CCSGameRules GetGameRules ( )
8158 {
82- return ! WarmupRunning ;
59+ var gameRulesEntities = Utilities . FindAllEntitiesByDesignerName < CCSGameRulesProxy > ( "cs_gamerules" ) ;
60+ var gameRules = gameRulesEntities . First ( ) . GameRules ;
61+
62+ if ( gameRules == null ! )
63+ {
64+ ThrowError ( "Failed to get game rules" ) ;
65+ return null ! ;
66+ }
67+
68+ return gameRules ;
8369 }
8470
8571 private static void SQL_ConnectCallback ( string connectionString , Exception exception , dynamic data )
0 commit comments