Added the repeatKey field to KeyEvent, distinguishing whether the event was triggered by the key being held down or the first press.

This commit is contained in:
Luis C.M committed 2022-05-03 13:20:41 -05:00
1 parent 4c0ff9bf2e
commit 5c9424bac8
4 files changed
+13 -9

No files matched your search

+2 -2
View File
@@ -395,9 +395,9 @@ public class EventHooks {
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerKeyPressed(EntityPlayerMP player, int button, boolean isCtrlPressed, boolean isShiftPressed, boolean isAltPressed, boolean isMetaPressed, boolean buttonDown, int[] heldKeys) {
public static void onPlayerKeyPressed(EntityPlayerMP player, int button, boolean isCtrlPressed, boolean isShiftPressed, boolean isAltPressed, boolean isMetaPressed, boolean repeatKey, boolean buttonDown, int[] heldKeys) {
PlayerDataScript handler = ScriptController.Instance.playerScripts;
KeyPressedEvent event = new KeyPressedEvent((ScriptPlayer)ScriptController.Instance.getScriptForEntity(player), button, isCtrlPressed, isAltPressed, isShiftPressed, isMetaPressed, buttonDown, heldKeys);
KeyPressedEvent event = new KeyPressedEvent((ScriptPlayer)ScriptController.Instance.getScriptForEntity(player), button, isCtrlPressed, isAltPressed, isShiftPressed, isMetaPressed, repeatKey, buttonDown, heldKeys);
handler.callScript(EnumScriptType.KEY_PRESSED, event);
WrapperNpcAPI.EVENT_BUS.post(event);
}