Fix ClassNotFoundException when vault is missing (#4151)

This commit is contained in:
Josh Roy 2021-05-14 12:33:25 -04:00 committed by GitHub
parent c9310ea429
commit 02193b0523
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -207,8 +207,13 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
@Override
public void onLoad() {
// Vault registers their Essentials provider at low priority, so we have to use normal priority here
getServer().getServicesManager().register(net.milkbowl.vault.economy.Economy.class, new VaultEconomyProvider(this), this, ServicePriority.Normal);
try {
// Vault registers their Essentials provider at low priority, so we have to use normal priority here
Class.forName("net.milkbowl.vault.economy.Economy");
getServer().getServicesManager().register(net.milkbowl.vault.economy.Economy.class, new VaultEconomyProvider(this), this, ServicePriority.Normal);
} catch (final ClassNotFoundException ignored) {
// Probably safer than fetching for the plugin as bukkit may not have marked it as enabled at this point in time
}
}
@Override