Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

economy linking not working with many plugins? #82

Closed
zach-all opened this issue Feb 1, 2012 · 3 comments
Closed

economy linking not working with many plugins? #82

zach-all opened this issue Feb 1, 2012 · 3 comments

Comments

@zach-all
Copy link

zach-all commented Feb 1, 2012

Hi,
My link isnt working, if there are many plugins loaded. I tried to find the bug but its not plugin specific and just if more then 30 plugins in the ./plugins folder it doesnt work with one specific plugin, Here is my Code:

RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(Economy.class);
if(economyProvider != null)
economy = economyProvider.getProvider();
else
{
log.info("["+pdf.getName()+"] Vault error: No economy provider!");
pm.disablePlugin(this);
return;
}
if(!economy.isEnabled())
{
log.info("["+pdf.getName()+"] Vault error: Economy disabled!");
pm.disablePlugin(this);
return;
}
@Sleaker
Copy link
Member

Sleaker commented Feb 1, 2012

the number of plugins doesn't effect Vault. You shouldn't be checking the economy enabled status unless you're absolutely certain your plugin loads after your economy. I imagine that it's failing because it thinks your econ is disabled when it loads your plugin.

@zach-all
Copy link
Author

zach-all commented Feb 1, 2012

ok thank you very much :)) SOLVED

@zach-all zach-all closed this as completed Feb 1, 2012
@dredhorse
Copy link

well the problem is that you are just checking for the provider once... it is a little bit more complicated like that (at least for me).

I use a boolean to signal that an economy provider was found and than check in my code if that is set before I do stuff...

if (checkVault != null && !plugin.isEconomyEnabled()) {
            plugin.setVaultFound(true);
            mainLogger.info("Vault detected");
            mainLogger.info("Checking economy providers now!");
        }
        if (plugin.isVaultFound() && !plugin.isEconomyEnabled()) {
            RegisteredServiceProvider<Economy> economyProvider = plugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
            if (economyProvider != null) {
                plugin.setEconomy(economyProvider.getProvider());
                plugin.setEconomyEnabled(true);
                mainLogger.info("Economy provider found: " + economyProvider.getProvider().getName());
                if (mainConfig.isEnableGetPayed()) {
                    mainConfig.setGetPayedActive(true);
                    mainLogger.info("Activating GetPayed!");
                }

            } else {
                if (missingEconomyWarn) {
                    mainLogger.warning("No economy provider found.");
                    mainLogger.info("Still waiting for economy provider to show up.");
                    missingEconomyWarn = false;
                }
            }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants