Make own Color Codes?

Discussion in 'Plugin Development' started by x4n0, Mar 14, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    x4n0

    Hi,
    how can I make Color Codes like them in Essentials?
    Example: I type "&6Hello". Then it will be displayed: "Hello".
    How can I do this?

    x4n0
     
  2. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Replace the & with ChatColor.COLOR_CHAR before sending.
     
  3. Offline

    x4n0

    Yes, that's for sure, but, when a player types it in a chat, how can i trim it then, or how to do it otherwise?
     
  4. Offline

    Sorroko

    try this .replaceAll("(&([a-f0-9]))", "\u00A7$2");
     
    x4n0 likes this.
  5. Offline

    x4n0

    Oh, thanks :)
     
    ryan7745 likes this.
  6. Offline

    AlbireoX

    Sometimes I really wish I knew Regex.
     
    ryan7745 likes this.
Thread Status:
Not open for further replies.

Share This Page