Solved Placeholder help

Discussion in 'Plugin Development' started by drillzy, Apr 25, 2017.

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

    drillzy

    Hello guys I am here to ask how would i make a placeholder code for the config on my plugin. I know i could use placeholderapi but i want an already built in placeholder instead of having to use dependencies. Can someone reply with an example of how to add any placeholder? it would be nice if you could send me the player name placeholder and a message that they sent placeholder. Help if you can!
     
  2. Offline

    Dnyce72799

    Use the .replace thing ex.
    getConfig().getString("string").replace("%player%", p.getName());

    Something like that.

    Sent from my LGLS775 using Tapatalk
     
  3. Offline

    Zombie_Striker

    @drillzy
    Why exactly do you not want to use PlaceholderAPI? Why do you want to re-invent the wheel?
     
  4. Offline

    drillzy

  5. Offline

    LittleUrso

    Code:
    public static String ReplacePlayer(Player p, String message){
            String replacedString = message.replaceAll("\\{player\\}", p.getName());
            return replacedString;
        }
    I don't know if it's the best way (probably not), but I usually do this.
     
  6. Offline

    FrostDevStudios

    @drillzy If this is solved, please mark this thread as Solved
     
Thread Status:
Not open for further replies.

Share This Page