Solved Customized config outside of the plugin

Discussion in 'Plugin Development' started by Surrend3r, May 16, 2018.

  1. Offline

    Surrend3r

    So, I'm trying to create a custom config that can be edited outside of the plugin, for example we have WorldEdit config that as soon as you launch your server for the first time it will create this config file:
    upload_2018-5-17_7-37-4.png
    Do you have any ideas on how I can do it?
     
  2. Online

    timtower Ninja on the waves Moderator

    @Surrend3r Check if the file exists already, if not: get the resource from the jar and save it in the plugins folder.
     
  3. Offline

    Surrend3r

    Can you show me an example of how to do it?
     
  4. Online

    timtower Ninja on the waves Moderator

    I won't spoonfeed.
     
  5. Offline

    Surrend3r

    So can you at least tell me whats the problem in the code?
    Code:
    String config = "config.yml";
    
            if (!getDataFolder().exists()) {
                getConfig().load(getResource(config));
            }
     
  6. Online

    timtower Ninja on the waves Moderator

    @Surrend3r You are trying to use a method that doesn't exist anymore.

    @Surrend3r saveResource(file) is a thing I believe.
     
    Last edited: May 17, 2018
  7. Offline

    KarimAKL

    @timtower @Surrend3r saveResource(String resourcePath, boolean replace) This is what i currently use and it works for me.
     
  8. Offline

    SunShineM22

  9. Offline

    Surrend3r

    Sorry for the late reply but it worked thanks!
     
  10. Offline

    KarimAKL

Share This Page