• Hello Guest! Did you know that ProjectKorra has an official Discord server? A lot of discussion about the official server, development process, and community discussion happens over there. Feel free to join now by clicking the link below.

    Join the Discord Server
Resource icon

Side Plugin PKConfigAPI 1.1

PKConfigAPI is an API for ProjectKorra that allows developers to forget about Configs, setting them and getting values from it, probably the most boring part when making an ability, maybe even the most time-consuming.

THIS API NEEDS TO BE AS A PLUGIN IN THE SERVER, OTHERWISE, IT WON'T WORK, SHADING IT INTO THE ABILITY ALSO WON'T WORK.

If you are using this for a side plugin, then it may be necessary to add
YAML:
depend: [PKConfigApi]
in plugin.yml

This should work on all PK versions, but it was tested on 1.8.7 and 1.9.0


This plugin comes with the command: /pkc reload
It reloads every ConfigAbility with new values from the config, it is a lot faster than ProjectKorra's reload.
Permission is the same as ProjectKorra's reload command.

A quick tutorial on how to use it:


First, you have to tag the ability as a "ConfigAbility", for example, like this:
Java:
@ConfigAbility()
public final class Ricochet extends AirAbility implements AddonAbility {
    // code
}
ConfigAbility() can take 4 arguments:
Java:
    String value() default "ExtraAbilities"; // Prefix to the config path.
    String configPath() default "config.yml"; // Ability config path (From the PK plugin directory).
    String languagePath() default "language.yml"; // Language config path (From the PK plugin directory)
    String plugin() default "ProjectKorra";
So, for example, if you want:
1. An ability with the path prefix "CoolAbilities"
2. Path equal to "BetterAbilities", and make the ability config file path as myconfigs/coolConfig.yml
3. Same as 2, but also with the language config file the same as the ability config file.
4. (For side plugins) You want your config to be in your plugin folder, for example, JedCore and have the JedCore prefix.
Java:
// 1.
@ConfigAbility("CoolAbilities")
public class Ricochet extends AirAbility implements AddonAbility {
    // code
}

// 2.
@ConfigAbility(value = "BetterAbilities", configPath = "myconfigs/coolConfig.yml")
public class Ricochet extends AirAbility implements AddonAbility {
    // code
}

// 3.
@ConfigAbility(value = "BetterAbilities", configPath = "myconfigs/coolConfig.yml", languagePath =  "myconfigs/coolConfig.yml")
public class Ricochet extends AirAbility implements AddonAbility {
    // code
}

// 4.
@ConfigAbility(value = "JedCore", plugin = "JedCore")
public class Ricochet extends AirAbility implements AddonAbility {
    // code
}
Now to create a ConfigValue (that will automatically update after a reload, the whole purpose of this API)
Java:
    // IT HAS TO BE STATIC NON-FINAL, otherwise, it won't work! Also, preferably don't update the values yourself, otherwise, it may change the default value.

    @ConfigValue("cooldown")
    private static long cooldown = 1000;

    @ConfigValue("damage")
    private static int damage = 1;

    @LanguageValue("Description")
    private static String description = "Some description {author} {element} {name}";

    // {author} will be changed to the ability author
    // {element} to the element of the ability
    // {name} to the name of the ability

    @LanguageValue("Usage")
    private static String usage = "Some usage";
Pretty self-explanatory.
Upon loading the plugin, all of the values that are assigned in the code (damage = 1, usage = "Some usage", etc.) will be saved as default values.
If you want to use a custom config, the plugin will automatically create it for you and update it.
Author
DomiRusz24
Downloads
32
First release
Last update
Rating
5.00 star(s) 1 ratings

Latest updates

  1. Added support to more ability types and side plugins.

    Added support for Abilities that don't implement AddonAbility, and the option to choose the...

Latest reviews

This is some amazing stuff! 5 stars for you.
DomiRusz24
DomiRusz24
Thanks!
Top