Solved setFormat

Discussion in 'Plugin Development' started by tkuiyeager1, Oct 3, 2015.

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

    tkuiyeager1

    Ok so i have this code in AsyncPlayerChatEvent:
    Code:
    e.setFormat(redprefix + "§4" + p.getName() + "§7: §r"
                        + e.getMessage());
    @timtower can you explain what is wrong with this?
     
  2. Offline

    timtower Administrator Administrator Moderator

    @tkuiyeager1 You are hardcoding the values in the format, any other plugin wanting to change those won't see any results out of it.
    The format is used by a String.format, first value will be the displayname, second value will be the message.
    Those values are represented by "%s"
     
  3. Offline

    tkuiyeager1

    @timtower then how can i add a prefix before the name?
     
  4. Offline

    timtower Administrator Administrator Moderator

  5. Offline

    tkuiyeager1

    @timtower %s is the name and the message too?
     
  6. Offline

    timtower Administrator Administrator Moderator

    @tkuiyeager1
    Yes
     
  7. Offline

    tkuiyeager1

    ok thanks @timtower
    Edit:
    @timtower is it ok to use this (prefix + "§1%s§r: %s")?

    Edit:
    Nvm.
     
    Last edited: Oct 3, 2015
Thread Status:
Not open for further replies.

Share This Page