Solved Action.LEFT_CLICK_BLOCK and Adventure Mode

Discussion in 'Plugin Development' started by Orcane, Oct 29, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    Orcane

    Solved - Use PlayerAnimationEvent instead of PlayerInteractionEvent

    Anyone know how I can work around Action.LEFT_CLICK_BLOCK not detecting when I left click on a block in adventure mode? Action.LEFT_CLICK_AIR works fine, but something about adventure mode stops packets been sent when you left click a block.

    This is what I have:

    Code:
            GameMode gamemode = player.getGameMode();
    
            if (gamemode == GameMode.ADVENTURE) {
                if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
                    player.sendMessage("Ding");
                }
            }
    Thanks in advance,
    Orcane
     
    Last edited: Oct 29, 2016
  2. Offline

    Zombie_Striker

    @Orcane
    I think you just answered your own question:
    If packets are not sent, how can the server know? You would either need to detect something else, or change them to survival mode and add the adventure features yourself. I would highly recommend the later, as all you need to do is add three lines to cancel all player interact events and block break events.
     
  3. Offline

    Orcane

    Yeah, if all else fails, I will just make player players in survival, but I would prefer to keep them in adventure just to make things a bit less bugy, or block-glitchy. So what do you think the most effective work-around would be?

    Perhaps there is there a way to listen for when a player just left clicks? Not on a block, or on air?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Oct 29, 2016
  4. Offline

    ipodtouch0218

  5. Offline

    Orcane

    This seems like a pretty good work-around, I'll test it our and tell you my results. Thanks! c:

    Worked like a charm, Thanks a ton iPodTouch <3

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Oct 29, 2016
    ipodtouch0218 likes this.
Thread Status:
Not open for further replies.

Share This Page