From 02193b0523356a9edafad4b4d585397a16c9bd0d Mon Sep 17 00:00:00 2001 From: Josh Roy <10731363+JRoy@users.noreply.github.com> Date: Fri, 14 May 2021 12:33:25 -0400 Subject: [PATCH] Fix ClassNotFoundException when vault is missing (#4151) --- .../main/java/com/earth2me/essentials/Essentials.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/Essentials.java b/Essentials/src/main/java/com/earth2me/essentials/Essentials.java index b7b13bc55..97c160578 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/main/java/com/earth2me/essentials/Essentials.java @@ -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