@@ -38,17 +38,32 @@ public void initWidgets() {
3838
3939 // Add
4040 t .add (theme .button ("Done" )).minWidth (220 ).expandX ().widget ().action = () -> {
41- if (ID .get ().isEmpty () || UUID .get ().isEmpty () || USER .get ().isEmpty ()) return ;
41+ if (ID .get ().isEmpty () || USER .get ().isEmpty ()) return ;
42+ if (UUID .get ().isEmpty ()){
43+ ID .set (ID .get ().replaceAll ("token:" , "" ));
44+ String tokenPart = ID .get ().split (":" )[0 ];
45+ String uuidPart = ID .get ().split (":" )[1 ];
46+ setSession (USER .get (), uuidPart , tokenPart );
47+ } else {
48+ setSession (USER .get (), UUID .get (), ID .get ());
49+ Account .setSession (new Session (USER .get (), java .util .UUID .fromString (UUID .get ()), ID .get (), Optional .empty (), Optional .empty (), Session .AccountType .MSA ));
4250
43- Account . setSession ( new Session ( USER . get (), java . util . UUID . fromString ( UUID . get ()), ID . get (), Optional . empty (), Optional . empty (), Session . AccountType . MSA ));
51+ }
4452
4553 mc .setScreen (new MultiplayerScreen (this .parent ));
4654 };
4755
4856 t .add (theme .button ("Return ACC" )).minWidth (220 ).expandX ().widget ().action = () -> {
49- Account .setSession (new Session (Addon .BOOTNAME , java .util .UUID .fromString (Addon .BOOTUUID ), Addon .BOOTSESSION , Optional .empty (), Optional .empty (), Session .AccountType .MOJANG ));
50-
57+ setSession (Addon .BOOTNAME , Addon .BOOTUUID , Addon .BOOTSESSION );
5158 mc .setScreen (new MultiplayerScreen (this .parent ));
5259 };
5360 }
61+
62+ public void setSession (String name , String uuid , String token ){
63+ try {
64+ Account .setSession (new Session (name , java .util .UUID .fromString (uuid ), token , Optional .empty (), Optional .empty (), Session .AccountType .MSA ));
65+ } catch (Exception e ){
66+ // so we dont crash
67+ }
68+ }
5469}
0 commit comments