MV Yanfly's Class Change plugin: how to "auto-equip" on class change?

Hey guys! So, I'm using Yanfly's Class Change plugin, which allows players to change an actor's class at will. However, whenever an actor's class is changed, some of their equipment is removed due to class restrictions.

It's quite easy to forget to re-equip stuff after changing class, so I was wondering if there's a way to call the "optimize" feature whenever an actor's class is changed, so they won't accidentally enter a battle unarmed...?

Thanks in advance!
there's a way to call the "optimize" feature whenever an actor's class is changed
not testing this at all, but try this.
go to line 1430, add a new line, and put in "this.actor().optimizeEquipments();"

that being said, heres usual disclaimer of "optimize isnt always smart about gearing"
Man, it worked like a charm, thank you so very much!! But just to make sure, this is where I was supposed to add that line, right?

Code:
Scene_Class.prototype.onItemCancel = function() {
    this._itemWindow.deselect();
    this._commandWindow.activate();
    this._helpWindow.setItem(null);
    this._itemWindow.refresh();
    this._compareWindow.setTempActor(null);
    this.actor().optimizeEquipments(); // EDITED BY NEO WITH THE AID OF ROBRO33 (2024/06/26)
};
Huh.
No actually. The (supposedly) clean copy of the plugin I keep around has line 1430 at the end of the onItemOk function right before this.refreshWindows
You're right, my bad. I do really need to get some sleep, lol. Thanks again, man!
I use Ramza's Optimize on Job Change, it pops up a little window and stuff.

Edit: Also,
that being said, heres usual disclaimer of "optimize isnt always smart about gearing"
Trihan has a plugin that allows you to customize how gear is considered for optimizing.

Original thread: https://forums.rpgmakerweb.com/threads/yanflys-class-change-plugin-how-to-auto-equip-on-class-change.169824/