Message after command

Discussion in 'Plugin Development' started by Snakebite2205, Jun 4, 2020.

Thread Status:
Not open for further replies.
  1. Hello,

    I recently started on plugin development but
    I need something for my plugin but i don't know how to make it

    I need something like if you do /112 you get the message

    "Type your help message"

    Then you have to type a message in chat and then the police gets a message with the message he wrote

    i have this:


    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if(cmd.getName().equalsIgnoreCase("112")) {
    if (sender instanceof Player) {
    Player player = (Player) sender;
    player.sendmessage("Type your help message");
    } else {
    sender.sendMessage("HEY! you can't use this in the terminal!");
    }
    return true;
    }
    }

    What i think i need is the first message after my command was used.

    This is for a Minetopia Roleplay server
     
  2. Offline

    timtower Administrator Administrator Moderator

    @Snakebite2205 You could use the Conversation API for that.
    Or just append the help message onto the command itself.
     
  3. You could use a hashmap with player uuids and booleans, whenever someone types the command they turn the boolean to true. From there, you check a player chat event and run code based of off what they typed and cancel the event so no one else sees it. Once their done, you can just turn the boolean back to false. A bit bodgy but I think it works well enough.
     
Thread Status:
Not open for further replies.

Share This Page