@@ -13,7 +13,7 @@ namespace CaiBotLite;
1313// ReSharper disable once ClassNeverInstantiated.Global
1414public class CaiBotLite ( Main game ) : TerrariaPlugin ( game )
1515{
16- public static readonly Version VersionNum = new ( 2026 , 06 , 21 , 0 ) ;
16+ public static readonly Version VersionNum = new ( 2026 , 07 , 7 , 0 ) ;
1717 internal static int InitCode = - 1 ;
1818 internal static bool DebugMode = Program . LaunchParameters . ContainsKey ( "-caidebug" ) ;
1919 private const string CharacterInfoKey = "CaiBotLite.CharacterInfo" ;
@@ -45,6 +45,7 @@ public override void Initialize()
4545 ProgressControlSupport . Init ( ) ;
4646 WebsocketManager . Init ( ) ;
4747 Commands . ChatCommands . Add ( new Command ( "caibotlite.admin" , CaiBotCommand , "caibotlite" , "cbl" ) ) ;
48+ ClearCharacterInfoForActivePlayers ( ) ;
4849 }
4950
5051 protected override void Dispose ( bool disposing )
@@ -64,6 +65,7 @@ protected override void Dispose(bool disposing)
6465 PlayerHooks . PlayerPostLogin -= PlayerHooksOnPlayerPostLogin ;
6566 GetDataHandlers . KillMe . UnRegister ( KillMe ) ;
6667 WebsocketManager . StopWebsocket ( ) ;
68+ ClearCharacterInfoForActivePlayers ( ) ;
6769 }
6870
6971 base . Dispose ( disposing ) ;
@@ -85,6 +87,7 @@ private static void OnGameUpdate(EventArgs args)
8587 }
8688
8789 _timer ++ ;
90+ LoginHelper . ProcessLoginQueue ( ) ;
8891 }
8992
9093 private static void KillMe ( object ? sender , GetDataHandlers . KillMeEventArgs e )
@@ -300,6 +303,14 @@ public static void GenBindCode(EventArgs? args)
300303 InitCode = new Random ( ) . Next ( 10000000 , 99999999 ) ;
301304 TShock . Log . ConsoleError ( $ "[CaiBotLite]您的服务器绑定码为: { InitCode } ") ;
302305 }
306+
307+ private static void ClearCharacterInfoForActivePlayers ( )
308+ {
309+ foreach ( var player in TShock . Players . Where ( x => x is { Active : true } ) )
310+ {
311+ player . RemoveData ( CharacterInfoKey ) ;
312+ }
313+ }
303314
304315
305316 #region 加载前置
@@ -320,4 +331,4 @@ public static void GenBindCode(EventArgs? args)
320331 }
321332
322333 #endregion
323- }
334+ }
0 commit comments