MV Yanfly Button Common Events Issue

Hi everyone! I'm using Yanfly's Button Common Events Plug In to allow players to use picture based menus and play mini games. The two plugin commands "SwitchButton All" and " RevertButton All" are great at swapping between interactions with menus, and allowing the player to navigate the map and interact with events via default controls.

But I noticed that when the player changes maps, the buttons always get reassigned to their common event binds. This means that if the player walks into a new map they will lose control of their character. The simple work around for this would be to include a "RevertButton All" command after the player is transferred anywhere, but it would be nice to not have to worry about that and have a little more control over the plug in.

Is there an easy fix for this?

I think either scene map or game interpreter would be the place that would need to be edited, or maybe some sort of switch check would need to be added to the whole thing? (I'll admit my java skills are really not good.)


Code:
//=============================================================================
// Scene_Map
//=============================================================================

Yanfly.BCE.Scene_Map_start = Scene_Map.prototype.start;
Scene_Map.prototype.start = function() {
    Yanfly.BCE.Scene_Map_start.call(this);
    Input._switchButton('ALL');
};

Yanfly.BCE.Scene_Map_updateScene = Scene_Map.prototype.updateScene;
Scene_Map.prototype.updateScene = function() {
    Yanfly.BCE.Scene_Map_updateScene.call(this);
    if (SceneManager.isSceneChanging()) return;
    if ($gameMap.isEventRunning()) return;
    this.updateButtonEvents();
};

Scene_Map.prototype.updateButtonEvents = function() {
    for (var key in Yanfly.Param.BCEList) {
      var eventId = Yanfly.Param.BCEList[key];
      if (eventId <= 0) continue;
      if (!Input.isRepeated(key)) continue;
      $gameTemp.reserveCommonEvent(eventId);
      break;
    }
};

//=============================================================================
// Game_Interpreter
//=============================================================================

Yanfly.BCE.Game_Interpreter_pluginCommand =
    Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
  Yanfly.BCE.Game_Interpreter_pluginCommand.call(this, command, args);
  if (command === 'RevertButton') this.revertButton(args);
  if (command === 'SwitchButton') this.switchButton(args);
  if (command === 'TriggerButton') this.triggerButton(args);
};

Game_Interpreter.prototype.revertButton = function(args) {
  if (!args) return;
  var button = args[0].toUpperCase();
  Input._revertButton(button);
};

Game_Interpreter.prototype.switchButton = function(args) {
  if (!args) return;
  var button = args[0].toUpperCase();
  Input._switchButton(button);
};

Game_Interpreter.prototype.triggerButton = function(args) {
  if (!args) return;
  var button = args[0].toLowerCase();
  if (button === 'cancel') button = 'escape';
  if (button === 'dash') button = 'shift';
  Input._latestButton = button;
  Input._pressedTime = 0;
};

Thanks in advance!

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-button-common-events-issue.137562/