Filled Simple Send Message

Discussion in 'Plugin Requests' started by Xp10d3, Jun 24, 2020.

  1. Offline


    Plugin category: RPG

    Minecraft version: 1.8.8

    Suggested name: SendMesssage

    What I want:
    This is quite simple. Basically, I'm using Citizens 2 and CommandNPC. However, I need my NPC's to say something. So, I need a plugin that creates this command:
    /sendmessage <@p | @a | @r | user> <prefix> <wait_time> <message1>|[message2]|[message3]|[message4]
    Let me break this down.
    The main command is /sendmessage. Afterwards, there is this:
    <@p | @a | @r | user>
    @p is whoever clicked the NPC OR whoever sent the message. @p cannot be used by console, however if it is sent through console it should default to whoever right clicks an NPC (hook-in to Citizens should make things easier). @a is everyone (like /broadcast), @r is a random user, and user is a specific user. Next is <prefix>. That is the prefix that will be sent before the message. For example if I were to do:
    /sendmessage @p [NPC] ...
    It will send a message to whoever right clicked the NPC with the following message:
    [NPC] somemessage
    Afterwards is <wait_time>. That's how long between each message the NPC will send. The wait time is in seconds. This is only required if there are multiple messages (which I will get into). Finally, there is the actual messages. There can be multiple lines of messages. Each line is separated with a line which is this:
    I don't know what that character is called, but it is above the backslash (\). If there are multiple lines of messages, the user is required to include a wait time. Note that any user can send this message and that it can also be sent through console.
    Here is an example:
    /sendmessage @p [NPC] 3 Hello._My_name_is_Xp10d3.|I_really_appreciate_you_right_clicking_on_me.|This_is_for_testing.|Hi.
    Let me break this down. Let's say I'm using CommandNPC and I set this command to right click. This will send a message to whoever right clicked the NPC since I used @p. The prefix will be [NPC] and between each message a 3 second delay will be added. I want underscores to be replaced by spaces, so the following will be sent:
    [NPC] Hello. My name is Xp10d3.
    [NPC] I really appreciate you right clicking on me.
    [NPC] This is for testing.
    [NPC] Hi.
    Note that you can have unlimited amount of messages, but at least one is required. Each message is separated by a line (no spaces).

    Ideas for commands:
    /sendmessage <@p | @a | @r | user> <prefix> <wait_time> <message1>|[message2]|[message3]|[message4]: Sends a message.

    Ideas for permissions:

    sendmessage.send: Allows use of /sendmessage.

    When I'd like it by: A.S.A.P.
  2. Offline


    With Minecraft 1.8 and Citizens 2, you can already achieve your example:
    /npc cmd add --cooldown 12 "tellraw <p> "[NPC] Hello. My name is Xp10d3.""
    /npc cmd add --cooldown 12 --delay 60 "tellraw <p> "[NPC] I really appreciate you right clicking on me.""
    /npc cmd add --cooldown 12 --delay 120 "tellraw <p> "[NPC] This is for testing.""
    /npc cmd add --cooldown 12 --delay 180 "tellraw <p> "[NPC] Hi <p>.""
    --cooldown is the number of seconds until the player can click and run the command again. 9 seconds is enough for your example but because of lags, it is better to add a few more.
    --delay is the number of ticks before the command will be executed (20 ticks = 1 second).

    With tellraw you can use usernames or target selectors (@p, @a, @r...). Your @p (the player who clicked the NPC) is <p> in Citizens.
    The message for tellraw is in JSON, so you can use colors and other interative stuff from Minecraft Vanilla.

    You can learn more:
    /npc help cmd (in game)
    NPC Commands

    Tell me if you still want a plugin, but I hope that fills your requirements. ;)
    Xp10d3 likes this.
  3. Offline


    @Spyromain Thank you! I'll definitely take a look at this. Marking as solved.

Share This Page