MZ [Question] How to Disable Button Long Press?

I have been looking over scripts on how to achieve disabling the in-game feature of long-pressing a button in a given event.

I have thought of—for example—a code like the one shown below to get the job done, but to no avail.

if (Input.isPressed("down")) { return false; }

However, RPG Maker MZ did not like that coded statement. Therefore, I'm hoping someone on the forum can help provide insight into the problem. Thanks for reading!
This will require a plugin, so

I've moved this thread to JS Plugin Requests. Thank you.

I think the following code should make isPressed return false whenever a non-Parallel event is running (save as a .js file, import as a plugin):
Spoiler: plugin code (untested)
JavaScript:
/*:
 * @target MZ
 * @help Free to use and/or modify for any project, no credit required.
 */
(alias => {
  Input.isPressed = function() {
    const sc = SceneManager._scene;
    if (
      (sc instanceof Scene_Map && $gameMap.isEventRunning()) ||
      (sc instanceof Scene_Battle && $gameTroop.isEventRunning())
    )
      return false;
    return alias.apply(this, arguments);
  };
})(Input.isPressed);
I imagine it will break various things, though. 😴

I recommend you give some more details/context on why you want to do this. For example, if it's to avoid skipping Show Text then you can specifically target the message object or window to avoid side-effects. If it's to force multiple presses of a direction to move multiple tiles on the map, target the appropriate movement method(s) instead. Or maybe you want to block specific inputs at specific times (e.g. when a switch is on). Etc.

Original thread: https://forums.rpgmakerweb.com/threads/question-how-to-disable-button-long-press.147023/