Using %player% in a config

Discussion in 'Spigot Plugin Development' started by EnSun580, May 5, 2015.

  1. So I was reworking a plugin, and I have desire to allow owners to use %player% in their config. If you don't already know what I'm on about, I mean so that using %player% in a config can pull a player's name from an event. Any idea hoe to go about this?
  2. Code (Text):

    Player player = event.getPlayer();

    String msg = getConfig().getString("message").replace("â„…playerâ„…", player.getName());

    • Informative Informative x 1
  3. invoke string#.replace("%player%", Player#.getName()) in your code <3
    #3 NaJated, May 5, 2015
    Last edited: May 5, 2015
    • Informative Informative x 1
  4. Thanks guys, cheers :)