22using EvolutionPlugins . OpenDeathMessages . API ;
33using EvolutionPlugins . OpenDeathMessages . Services ;
44using Microsoft . Extensions . Configuration ;
5+ using Microsoft . Extensions . Localization ;
56using OpenMod . Core . Commands ;
67using OpenMod . Unturned . Commands ;
78using OpenMod . Unturned . Users ;
@@ -17,11 +18,14 @@ public class CommandDeathMessageDisplay : UnturnedCommand
1718 {
1819 private readonly IPlayerMessager m_PlayerMessager ;
1920 private readonly IConfiguration m_Configuration ;
21+ private readonly IStringLocalizer m_StringLocalizer ;
2022
21- public CommandDeathMessageDisplay ( IServiceProvider serviceProvider , IPlayerMessager playerMessager , IConfiguration configuration ) : base ( serviceProvider )
23+ public CommandDeathMessageDisplay ( IServiceProvider serviceProvider , IPlayerMessager playerMessager , IConfiguration configuration ,
24+ IStringLocalizer stringLocalizer ) : base ( serviceProvider )
2225 {
2326 m_PlayerMessager = playerMessager ;
2427 m_Configuration = configuration ;
28+ m_StringLocalizer = stringLocalizer ;
2529 }
2630
2731 protected override async UniTask OnExecuteAsync ( )
@@ -50,7 +54,7 @@ protected override async UniTask OnExecuteAsync()
5054 var user = ( UnturnedUser ) Context . Actor ;
5155 await m_PlayerMessager . ChangeDisplayTypeAsync ( user . Player , displayType ) ;
5256
53- await PrintAsync ( m_Configuration [ $ "commands:deathMessageDisplay:{ ( displayType is DisplayType . Global ? "global" : "group" ) } "] ) ;
57+ await PrintAsync ( m_StringLocalizer [ $ "commands:deathMessageDisplay:{ ( displayType is DisplayType . Global ? "global" : "group" ) } "] ) ;
5458 }
5559 }
5660}
0 commit comments