mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-12-28 19:48:01 +01:00
Fix for Vault economy integration bugging out if the target economy plugin loaded after Factions (really seems like a Vault issue, but we'll work around it)
Fix for users who have Vault but don't use economy getting an NPE
This commit is contained in:
parent
fb92fb7c68
commit
5ac0baf84a
@ -99,8 +99,7 @@ public class P extends MPlugin
|
||||
//setupPermissions();
|
||||
integrateEssentialsChat();
|
||||
setupSpout(this);
|
||||
Econ.doSetup();
|
||||
Econ.oldMoneyDoTransfer();
|
||||
Econ.initialSetup(this);
|
||||
CapiFeatures.setup();
|
||||
setupLWC();
|
||||
|
||||
|
@ -33,6 +33,25 @@ public class Econ
|
||||
return econ != null;
|
||||
}
|
||||
|
||||
public static void initialSetup(P p)
|
||||
{
|
||||
if (Bukkit.getServer().getPluginManager().getPlugin("Vault") == null)
|
||||
{
|
||||
P.p.log("Economy integration is "+(Conf.econEnabled ? "enabled, but" : "disabled, and")+" the plugin \"Vault\" is not installed.");
|
||||
return;
|
||||
}
|
||||
|
||||
p.getServer().getScheduler().scheduleSyncDelayedTask(p, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
doSetup();
|
||||
oldMoneyDoTransfer();
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
|
||||
public static void doSetup()
|
||||
{
|
||||
if (isSetup()) return;
|
||||
@ -40,6 +59,11 @@ public class Econ
|
||||
if (Bukkit.getServer().getPluginManager().getPlugin("Vault") != null)
|
||||
{
|
||||
RegisteredServiceProvider<Economy> rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
|
||||
if (rsp == null)
|
||||
{
|
||||
P.p.log("Economy integration is "+(Conf.econEnabled ? "enabled" : "disabled")+", but the plugin \"Vault\" is not hooked into an economy plugin.");
|
||||
return;
|
||||
}
|
||||
econ = rsp.getProvider();
|
||||
|
||||
P.p.log("Economy integration through Vault plugin successful.");
|
||||
@ -47,10 +71,6 @@ public class Econ
|
||||
if ( ! Conf.econEnabled)
|
||||
P.p.log("NOTE: Economy is disabled. Enable with command: f config econEnabled true");
|
||||
}
|
||||
else
|
||||
{
|
||||
P.p.log("Economy integration is "+(Conf.econEnabled ? "enabled, but" : "disabled, and")+" the plugin \"Vault\" is not installed.");
|
||||
}
|
||||
|
||||
P.p.cmdBase.cmdHelp.updateHelp();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user