Solved Editing Configs With APIs

Discussion in 'Plugin Development' started by baugh70, Aug 26, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    baugh70

    Hey all,

    I am currently making a set of plugins that depend on Tokens. Because their wasn't only one plugin I made an "API" type thing, that basically handles setting and getting token amount from certain players. But I have this method:
    Code:java
    1. public void setTokens(int tokens){
    2. plugin.getConfig().set(player.toString(), tokens);
    3. plugin.saveConfig();
    4. }

    Which when called does print to a config, just not the API's Config, which is the Universal config that I would like it to print to. Instead it prints to the config of the plugin that calls the method. Is there a specific way I can change the code in the API that enables it to print the data onto the TokensAPI plugin. Thank you all in advance!

    -Baugh70
     
  2. Offline

    Skye

    baugh70 Where is plugin defined? Is the API's constructor setting plugin as the plugin that is instantiating/getting the class?
     
  3. Offline

    baugh70

    Skye I realized what my error was, when I created constructor I added the standard plugin variable but instead of making a separate constructor for that, I used the main class in the other plugin. Thank you very much.
     
  4. Offline

    Skye

    baugh70 You're welcome. :) If you mark the thread as solved, it'll spare a few people some clicks. ;)
     
Thread Status:
Not open for further replies.

Share This Page