mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-11-21 05:15:11 +01:00
🔨 force plugin shutdown if an economy plugin wasn't found
Took 46 seconds
This commit is contained in:
parent
d00c26ef40
commit
ba9793835a
@ -46,6 +46,7 @@ import ca.tweetzy.flight.command.CommandManager;
|
||||
import ca.tweetzy.flight.comp.enums.ServerVersion;
|
||||
import ca.tweetzy.flight.config.tweetzy.TweetzyYamlConfig;
|
||||
import ca.tweetzy.flight.database.*;
|
||||
import ca.tweetzy.flight.utils.Common;
|
||||
import co.aikar.taskchain.BukkitTaskChainFactory;
|
||||
import co.aikar.taskchain.TaskChain;
|
||||
import co.aikar.taskchain.TaskChainFactory;
|
||||
@ -192,7 +193,11 @@ public class AuctionHouse extends TweetyPlugin {
|
||||
dataMigrationManager.runMigrations();
|
||||
|
||||
// setup Vault Economy
|
||||
setupEconomy();
|
||||
if (!setupEconomy() ) {
|
||||
Bukkit.getServer().getConsoleSender().sendMessage(Common.colorize("&7[&eAuctionHouse&7] &f- &cCould not setup vault, please make sure you have an economy plugin."));
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
// gui manager
|
||||
this.guiManager.init();
|
||||
@ -469,17 +474,15 @@ public class AuctionHouse extends TweetyPlugin {
|
||||
}
|
||||
|
||||
// helpers
|
||||
private void setupEconomy() {
|
||||
private boolean setupEconomy() {
|
||||
if (getServer().getPluginManager().getPlugin("Vault") == null) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
final RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
|
||||
|
||||
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
|
||||
if (rsp == null) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
this.economy = rsp.getProvider();
|
||||
return this.economy != null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user