Economy Issues

Discussion in 'Plugin Development' started by beastman3226, Dec 14, 2013.

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

    beastman3226

    The major economy plugins no longer support Vault (mineconomy, boseconomy, and iConomy). I was wondering how I should implement economies into my plugin now.
     
  2. Offline

    The_Doctor_123

  3. Offline

    the_merciless

    What makes you think they are not supported?
     
  4. Offline

    beastman3226

    None of them implement the economy classes which makes it to where the RSP can't find the classes to give my plugin eco support.

    That was really helpful, too bad you didn't offer any suggestion on how to fix it/work around. I really don't mean to sound condescending but I am not some newbie who doesn't know squat.
     
  5. Offline

    The_Doctor_123

    beastman3226
    I'm not sure why this message isn't getting to you:

    They are supported.
     
  6. Offline

    the_merciless

  7. Offline

    beastman3226

    The_Doctor_123
    I posted before you edited, my bad. But still, why doesn't the RSP find the economy class inside those plugins? Or should I do individual support?
     
  8. Offline

    the_merciless

  9. Offline

    The_Doctor_123

  10. Offline

    beastman3226

    the_merciless
    *facepalm* I understand that I need Vault! I get how to implement an economy. But!!!!!!!!!!!!!!!! Read closely here please! When the registered service provider looks for the economy class it can't find it!!! This is a problem with the economy plugins I have been using.

    RegisteredServiceProvider

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  11. Offline

    The_Doctor_123

    beastman3226
    Vault is a middleman between your plugin and some other economy plugin. This means that you don't need to know anything about what the economy plugin is.
     
  12. Offline

    beastman3226

    The_Doctor_123
    Alright, so I implement Vault as instructed. I added some debug statements because I wanted to see the values of the variables as it stepped through the setup process. This line of code:
    Code:java
    1. RegisteredServiceProvider<net.milkbowl.vault.economy.Economy> rsp = (RegisteredServiceProvider<net.milkbowl.vault.economy.Economy>) this.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);

    returns null and doesn't allow me to use any features of any economy plugin. I am trying to figure out why and how I can work around it.
     
  13. Offline

    boysnnoco

    beastman3226 you need to have a vault dependency in your plugin.yml as well as have vault in your server :)
     
  14. Offline

    beastman3226

    boysnnoco
    As I said, I installed Vault as instructed.
     
  15. Offline

    the_merciless

    Why are you adding that line as debug. If you follow the instructions in the link I provided you you will see how to get the rsp properly and if it's null, vault will fail to load.

    Code:java
    1.  
    2. @Override
    3. public void onEnable() {
    4. if (!setupEconomy() ) {
    5. log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
    6. getServer().getPluginManager().disablePlugin(this);
    7. return;
    8. }
    9.  
    10. }
    11.  
    12. private boolean setupEconomy() {
    13. if (getServer().getPluginManager().getPlugin("Vault") == null) {
    14. return false;
    15. }
    16. RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
    17. if (rsp == null) {
    18. return false;
    19. }
    20. econ = rsp.getProvider();
    21. return econ != null;
    22. }
    23.  
    24.  


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  16. Offline

    beastman3226

    the_merciless
    Because I wanted to see what was happening. I also figured it out, the economy plugin is getting initialized AFTER Vault which doesn't allow Vault to link in with the economy plugin, if someone could please tell me how to reorder initialization.
     
Thread Status:
Not open for further replies.

Share This Page