Get input from a player spectating entity?

Discussion in 'Plugin Development' started by Symphonic, May 28, 2020.

  1. Offline

    Symphonic

    Essentially I have a player who is spectating an entity (in spectator mode) and I need a way to get input from them (button press). I can't do dismount because I'm already using that for something else. Is there any other way I can get input? PlayerInteractEvent is not reliable for spectators.
     
  2. Offline

    Kars

    It is not possible to get button input server-side. PlayerInteractEvent is what you have.
    Why is it not reliable?
     
  3. Offline

    Symphonic

    I am aware that it is not possible. I was wondering if there is another thing I wasn't thinking of that sent a packet to the server when a player is spectating an entity.

    PlayerInteractEvent is not called if the entity the player is spectating is not looking at a block.
     
  4. Offline

    Kars

    @Symphonic perhaps give them an item in each of their slots.
     
  5. Offline

    Symphonic

    You can’t give items to spectators?
     
  6. Offline

    Machine Maker

    If you want to see what packets are being sent to the server use ProtocolLib and just setup a listener for ALL the packets and filter them by player. Then you can try some things to see if anything is sent. For instance, there is a hotbar in spectator mode, not sure if its visible when spectating an entity but there might be something there about changing selected inventory slots.
     
  7. Offline

    Symphonic

    I'll check that. Thanks!
     

Share This Page