@@ -7,7 +7,7 @@ namespace PrefPro;
77public class NameHandlerCache
88{
99 private readonly Configuration _configuration ;
10- private string ? _playerName ;
10+ public string ? PlayerName ;
1111
1212 public HandlerConfig Config { get ; private set ; } = HandlerConfig . None ;
1313
@@ -22,31 +22,36 @@ private void FrameworkOnUpdate(IFramework framework)
2222 {
2323 if ( DalamudApi . ClientState . IsLoggedIn && DalamudApi . ClientState . LocalPlayer is { } localPlayer ) {
2424 DalamudApi . Framework . Update -= FrameworkOnUpdate ;
25- _playerName = localPlayer . Name . TextValue ;
25+ PlayerName = localPlayer . Name . TextValue ;
2626 Refresh ( ) ;
2727 }
2828 }
2929
3030 private void OnLogout ( int type , int code )
3131 {
32- if ( _playerName != null ) {
33- _playerName = null ;
32+ if ( PlayerName != null ) {
33+ PlayerName = null ;
3434 Config = HandlerConfig . None ;
3535 DalamudApi . Framework . Update += FrameworkOnUpdate ;
3636 }
3737 }
3838
3939 public void Refresh ( )
4040 {
41- if ( _playerName != null ) {
42- Config = CreateConfig ( _configuration , _playerName ) ;
41+ if ( PlayerName != null ) {
42+ Config = CreateConfig ( _configuration , PlayerName ) ;
4343 }
4444 }
4545
4646 private static HandlerConfig CreateConfig ( Configuration config , string playerName )
4747 {
4848 var data = new HandlerConfig ( ) ;
4949
50+ if ( string . IsNullOrEmpty ( config . Name ) )
51+ {
52+ return HandlerConfig . None ;
53+ }
54+
5055 if ( config . Name != playerName )
5156 {
5257 data . ApplyFull = true ;
@@ -78,7 +83,8 @@ private static HandlerConfig CreateConfig(Configuration config, string playerNam
7883
7984 private static string GetNameText ( string playerName , string configName , NameSetting setting )
8085 {
81- switch ( setting ) {
86+ switch ( setting )
87+ {
8288 case NameSetting . FirstLast :
8389 return configName ;
8490 case NameSetting . FirstOnly :
0 commit comments