1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Detect when player enter command which doesn't exists

Discussion in 'Development' started by Kyd, Sep 29, 2017.

  1. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    I want to do check when player send command for example /blabla , but command doesn't exist and then I want to cancel sending..
    Is this possible?????????
     
  2. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
  3. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
  4. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    1. What command did you type
    2. Did you make sure to register the class as a listener
    3. Did you make sure the function was called at all? maybe using an echo statement
     
  5. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    /unknowncommand isn't a command therefore PlayerCommandPreprocessEvent won't be triggered. try PlayerChatEvent instead.
     
  6. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    I type /unknowncommand
    Yes class have registered listener
    Function was called
     
  7. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    i thought it fires before anything was touched
     
    Muqsit, jasonwynn10 and AshBull like this.
  8. AshBull

    AshBull Spider Jockey

    Messages:
    31
    PlayerCommandPreprocessEvent

    PlayerCommandPreprocessEvent fires no matter what.
     
    jasonwynn10 likes this.
  9. Karanpatel567

    Karanpatel567 Baby Zombie

    Messages:
    115
    GitHub:
    Karanpatel567
    Why use PlayerChatEvent, Do you what that is? That's when a player types a message.
     
    Muqsit likes this.
  10. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Tried PlayerCommandPreprocessEvent and PlayerChatEvent and don't work
    Any ideas please
     
  11. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    just found out.. but its fired when a command is runed to.
     
  12. LewBr

    LewBr Zombie

    Messages:
    385
    GitHub:
    lewbr
    Why /Help i can't cancel now?
     
  13. SalmonDE

    SalmonDE Zombie Pigman

    Messages:
    739
    GitHub:
    SalmonDE
    @LewBr because it's client side afaik
     
  14. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    This is long time solved I only forgot to change tag sorry :D
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.