How to add {username}

Discussion in 'Plugin Development' started by C0lA_K1nG, Mar 22, 2014.

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

    C0lA_K1nG

    I want to learn how to add a '{username}' tag to a string in my config whereas if the config reads:

    Code:
    Message: {Username} says hi
    it would show up as: 'C0lA_K1nG says hi'
     
  2. Offline

    Arcoz

    Use: getConfig().getString("string").replaceall("{username}", sender.getName());
     
  3. Offline

    C0lA_K1nG

    Do I put that in my onEnable code?
     
  4. Offline

    AoH_Ruthless

  5. Offline

    Wizehh

    No. For example, if you're putting in a command:
    PHP:
    String message null;
    message getConfig().getString("message").replace("{player}"player.getName);
     
  6. Offline

    C0lA_K1nG

    okay thanks :)
     
  7. Offline

    Arcoz

    No, for example with a command:


    PHP:
     if(cmd.getName().equalsIgnoreCase("hi")) sender.sendMessage(getConfig().getString("message").replaceAll("{username}"sender.getName()));
    EDIT: Oh Wizehh, so fast ;L
     
Thread Status:
Not open for further replies.

Share This Page