how do I implement config.yml files?

Discussion in 'Spigot Plugin Development' started by lilmikey0174, Jul 3, 2018.

  1. When You make a plugin how do you make a config.yml file able to read the data you imput...
    (logic 1 million)
    in config.yml:
    Code (Text):

    #Idk wot to do here
    Code (Text):
    player.sendMessage(ChatColor.DARK_GRAY + Discord)
    Does this make sense at all?
    Essentially I am asking how can I define a variable from config.yml (I think)
  2. You have two options. Either use regex to find and replace a section
    Code (Java):
    message = message.replaceAll("<Discord Link>", config.getString("Discord"));
    Or, if you plan to allow them to write actual java and have the server then run it when you call it, you'll want to use an evaluator of some kind.
    Here's a link to one of them called BeanShell.