Solved Weird PlayerInteractEvent on GameMode.SPECTATOR

Discussion in 'Spigot Plugin Development' started by mkcoldwolf, Jul 15, 2018.

  1. so im using PlayerInteractEvent and i want to detect whenever player left click and leave SPECTATOR mode
    but its weird when player in SPECTATOR mode, every action fire when in SURVIVAL mode
    but when in SPECTATOR mode, the action LEFT_CLICK_BLOCK and RIGHT_CLICK_AIR doesn't fire,
    any way to slove this?
     
  2. ScarabCoder

    ScarabCoder Retired Resource Staff
    Retired

    If it isn't firing it's probably because the client doesn't tell the client that he's left/right clicking blocks. Unfortunately, it isn't possible.
     
  3. In spectator mode you can’t click blocks, that’s why.
     
  4. okay thanks, anyways to avoid the problem and still do the same result?
    not gona make "fake" gamemode 3 like hypixel :L
     
  5. as scarab said (and I believe is correct) the client stops the event, so there isn't a good way around this.

    The only way I would know how is via a fake gamemode 3 as you are stated you are opposed to. If you handled it correctly I'm not sure why you would be adverse to this solution?
     
  6. it actually blocks arrows, in "fake" gamemode 3 the entity is still there, but in real gamemode 3 the entity dont even exist
     
  7. ScarabCoder

    ScarabCoder Retired Resource Staff
    Retired

  8. The question is, perhaps there’s another way around it: why do you need to know when they click? They can’t click anything anyway.

    Edit: @ScarabCoder stop replying at the exact same time as me lol
     
    • Funny Funny x 1
  9. k thanks, this question kinda sloved, btw im not gona use packets things, those "a" "b" "c" im done with them :L
    i know they cant click, but i want to know when they click, just like when u press enter in game, u cant do anything but i want to open the chat menu , we are devs, is to change how game works -.-
     
  10. There are other ways than to click lmao. I’ll just let you stew honestly. Especially since you have ‘solved’ it.
     
  11. i just wanna detect them click, thats how i want the game work like . its kinda what the effect i want though, why are u just telling me there is not possible and not finding a way to solve it, so if u cant create a video then not trying to solve it but turn into make a suck string game in 2018?,
    also let me give u a example
    https://bukkit.org/threads/how-to-check-when-player-opens-his-inventory.321103/
     
  12. ScarabCoder

    ScarabCoder Retired Resource Staff
    Retired

    We don't need a video explanation, it just isn't possible with the way that the client is programmed.
     
    • Agree Agree x 1
  13. You're asking us to change it and to fix it for you, furthermore you said earlier something along the lines of, 'we're developers, we change the game' - not true. We use an API to modify the server experience as much as we possibly can. Since you're asking us to change the client's behaviour that's not the API nor in the scope of the server.
     
  14. i think u misunderstand my example though
    no i am not just wanting u guys to 'fix' it for me, i am just trying to find a way to avoid the problem since what @JustRayz , we are using the API and we cannot edit the client, then we should "AVOID" it , not to fix it
    [​IMG]
    [​IMG]
    [​IMG]
    This is how they "AVOID" the problem not just saying "Its impossible" and do other stuff instead
     
  15. Sorry to butt in on this, but they're not saying it's impossible just to avoid the problem, it's 100% not possible. If the client does not tell the server it is clicking blocks while in spectator mode, then there's no way for your plugin to detect it, end of story. There's nothing you can do to work around that.
     
    • Agree Agree x 1
    • Optimistic Optimistic x 1
  16. Take the InevntoryClickEvent for example: the client sends a packet to the server TELLING it that it has just opened an Inventory, Spigot then calls the event and allows the developer to do stuff.

    Other issues can have cool workarounds by using NMS since the packet does exist, but implementation doesn’t.

    This is, as far as I am aware, IMPOSSIBLE. The server never even knows that you clicked since the client never told it, therefore it’s not a case of using NMS, or a limitation of spigot. It’s just not possible. It’s like saying, I want to know when the client minimises Minecraft, you can’t (server side) since the client doesn’t tell the server they did.
     
    • Optimistic Optimistic x 1
  17. k whatever, packets will handle them all. atleast the packet when server tell what to display on player's inventory

    EDIT:
    i means packets when tell wat players clicked, something.
     
    #17 mkcoldwolf, Jul 18, 2018
    Last edited: Jul 18, 2018
  18. ScarabCoder

    ScarabCoder Retired Resource Staff
    Retired

    I think I already told you it could be possible if you are willing to play around with packets. Check the thread I linked earlier.
    But it sounded like you weren't, so no, it isn't possible.
     
    • Winner Winner x 1
  19. The thread is very old and i know that is impossible, but the game still detect spectator mode left click air, so is there a way to make that when you are in spectator mode the game don't detect the blocks?