Sueta
KO

Konfig: Easily add configuration to your plugin (API)

1.0.1

Easily add configuration to your plugin (API)

·Config

Easily add configuration to your plugin with Konfig.

Maven:
Repo:

<repositories> 
  <repository> 
    <id>bintray-simpleauthority-konfig</id> 
    <url>https://dl.bintray.com/simpleauthority/konfig</url> 
  </repository> 
</repositories>

Dependency:

<dependencies> 
  <dependency> 
    <groupId>com.algorithmjunkie.mc</groupId> 
    <artifactId>konfig-?</artifactId> 
    <version>1.0.1</version> 
    <scope>compile</scope> 
  </dependency> 
</dependencies>

Change the ? to one of "core", "bukkit", or "bungee". Use core to reimplement Konfig for your platform. Use bukkit or bungee to use the library on either platform respectively.

Example :
Create a Konfig:

public   class  TestKonfig  extends  BukkitKonfig  {  
     public  TestKonfig  (  JavaPlugin plugin  )   {  
         // place test.yml in plugin's data folder  
         super   (  plugin,  "test.yml"  , plugin.  getDataFolder   (   )   )   ;  
     }  
    
     // now create methods to access your data  
     public    String   getAuthToken  (   )   {  
         return  getString  (   "auth-token"   )   ;  
     }  
    
     public  List  <  String  >  getBlockedUsers  (   )   {  
         return  getStringList  (   "blocked-users"   )   ;  
     }  
 }

Then use it:

public class TestPlugin extends JavaPlugin { 
    @Override 
    public void onEnable() { 
        TestKonfig konfig = new TestKonfig(this); 
        String authToken = konfig.getAuthToken(); 
        List<String> blockedUsers = konfig.getBlockedUsers(); 
    } 
}

That's it.

Similar projects

Config →