Filled PlayerChatCommands

Discussion in 'Plugin Requests' started by Dr_Lobster_face, Nov 6, 2018.

  1. Offline

    Dr_Lobster_face

    Plugin category: Custom Triggers and Scripts

    Minecraft version: 1.11.2

    Suggested name: PlayerChatCommands

    What I want: I'd like a plugin that would run config defined commands when a player says something in chat.

    How I'd like the config to look:
    Code:
    name:
    Regex: true/false
    Chat message: "message"
    Commands:
      - "/command#1"
      - "/command#2"
      etc.. (you can specify as many commands as you like here)
    
    example:
    Regex: false
    Chat message: "hi!"
    Commands:
      - "/say Hi!"
    ^^ Will only activate if the chat receives the exact message. This would not activate if chat received this message:
    
    [Player] Guy: hi!
    
    Only this one:
    hi! 
    example2:
    Regex: true
    Chat message: "[.*] .*: hi!"
    Commands:
      - "/say Hi!"
    ^^ Will activate if chat receives the chat message
    [blah] blah: hi!
    or
    [blum] blum: hi!
    This because it's using a Regular expression
    .* means that anything can go there
    
    Ideas for placeholders:
    (Support for placeholder API would be awesome)
    Code:
    %playername% - The name of the player who sent the chat message
    
    Ideas for commands:
    Code:
    /pcc reload - Reloads the config
    
    Ideas for permissions: pcc.reload - False if they can't reload the plugin.
    When I'd like it by: ASAP

    Thanks in advance!
     
    Last edited: Nov 8, 2018
  2. Offline

    KarimAKL

    @Dr_Lobster_face What does the .* mean in example2 of the config?
    Code:
    Chat message: "[.*] .*: hi!"
     
  3. Offline

    Dr_Lobster_face

  4. Offline

    KarimAKL

    @Dr_Lobster_face I can pretty much guess everything else but i'm kinda stuck on what the boolean "Regex" in your config example should do if it's true/false. :/ Could you explain? I'll try creating this but i can't promise anything. :7
    EDIT: Should the player be the one executing the commands or should it be the console?
     
    Last edited: Nov 7, 2018
  5. Offline

    Dr_Lobster_face

    If set to true, it would parse Regular Expressions in the
    Code:
    Chat Message
    section.
    https://en.wikipedia.org/wiki/Regular_expression
     
  6. Offline

    KarimAKL

    @Dr_Lobster_face Does that mean that if regex is true the .* would work for everything and if it's false .* would only work for .*? Please let me know if that didn't make any sense. :7
    Also you didn't answer my question:
     
  7. Offline

    Dr_Lobster_face

    If true, .* will work as RegEx
    If false, .* will be interpreted as a literal string.
    The console
     
  8. Online

    timtower Ninja on the waves Moderator

    @Dr_Lobster_face Do you need the text of the message itself or do you want to include the format?
    Because we can get the regular message as well, even easier than doing it the regex way.
     
  9. Offline

    Dr_Lobster_face

    Could you clarify what you mean?
     
  10. Online

    timtower Ninja on the waves Moderator

    Re-read the post.
    Was wrong in my thinking.
     
  11. Offline

    Dr_Lobster_face

    The "Chat Message" section looks for the actual line of text. Including all player prefixes & suffixes. Editing my OP to make that clearer.
     
  12. Offline

    Dr_Lobster_face

  13. Offline

    0-o

    I wrote your plugin.
    You should look up and keep note of regular expressions in the Java language.
    You must put a double backslash before any of these characters
    <([{\^-=$!|]})?*+.>:
    that appear in the config if you don't want them to be a part of the regular expression

    FOR EXAMPLE:

    [.*] .*: hi! IS NOT EQUAL TO [blah] blah: hi!
    \\[.*\\] .*\\: hi! IS EQUAL TO [blah] blah: hi!

    https://drive.google.com/open?id=1ERm6Y5a63Cn5wS07s4T3SUzT-JHmIwSL
     
    Last edited: Nov 18, 2018 at 4:37 PM
  14. Offline

    Dr_Lobster_face

Share This Page