Key Combination

Discussion in 'Plugin Development' started by wizzinangel, Aug 19, 2013.

  1. Offline

    wizzinangel

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Is there a way to detect a key combination, so like the player holds 'Shift' and left clicks on something? as apposed to just Action.Left_Click?
  2. Offline

    exload

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    You can't log key presses but you could see if the player is crouching when they left click.
  3. Offline

    dunbaratu

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    The Bukkit API does server-side things. Reacting to an exact keypress as it happens is a client-side thing. For example, when you press "W" to move forward, the server is unaware of the fact that "W" was pressed. All it knows is that the client told it "this player now has a forward velocity of X"

    So to trap a "keypress" in Bukkit API you have to trap the *effect of* the keypress rather than the keypress itself.

    So you can't catch the shift key, but can catch that a player is crouching (or 'sneak' as it's called for some strange reason I don't understand since it doesn't make you hard to see). You can't catch the spacebar but you can trap the jump that the spacebar causes. You can't catch the mouse moving left and right but you can read what the player's facing is, and so on.

Share This Page