Solved Chat Format Outside of Chat Event?

Discussion in 'Spigot Plugin Development' started by TechBug2012, Jun 8, 2017.

  1. Just for fun, I'm making a plugin that replicates Slack's /shrug command, which appends ¯\_(ツ)_/¯ to a user's message when they use the command. I want to make it look as if the player actually sent a chat message in a way that's something like this:
    Code (Java):

    StringBuilder sb = new StringBuilder();
    for (String arg : args) sb.append(arg);
    getServer().broadcastMessage(String.format(the-format, p.getDisplayName(), sb.toString() + " ¯\\_(ツ)_/¯"));
    However, the only way I know to get the chat format is from the chat event. Is there another way to get the chat format?

    EDIT: I forgot existed. That made it work. Sorry for posting this thread.
    #1 TechBug2012, Jun 8, 2017
    Last edited: Jun 8, 2017
  2. Don't forget to mark your thread as solved. ;)
    • Like Like x 1