mirror of
https://github.com/Flowsqy/ShopChest.git
synced 2025-03-01 16:01:03 +01:00
Add ShopChest#cancelLoading method
This commit is contained in:
parent
01948377d6
commit
57b1a40dfd
@ -105,16 +105,12 @@ public class ShopChest extends JavaPlugin {
|
||||
// Load Vault
|
||||
// TODO Load Vault in dedicated class
|
||||
if (!getServer().getPluginManager().isPluginEnabled("Vault")) {
|
||||
debugLogger.debug("Could not find plugin \"Vault\"");
|
||||
getLogger().severe("Could not find plugin \"Vault\"");
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
cancelLoading("Could not find plugin \"Vault\"");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!setupEconomy()) {
|
||||
debugLogger.debug("Could not find any Vault economy dependency!");
|
||||
getLogger().severe("Could not find any Vault economy dependency!");
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
cancelLoading("Could not find any Vault economy dependency!");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -123,11 +119,7 @@ public class ShopChest extends JavaPlugin {
|
||||
try {
|
||||
platform = platformLoader.loadPlatform();
|
||||
} catch (RuntimeException e) {
|
||||
debugLogger.debug(e.getMessage());
|
||||
debugLogger.debug("Disabling the plugin");
|
||||
debugLogger.getLogger().warning(e.getMessage());
|
||||
debugLogger.getLogger().warning("Disabling the plugin");
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
cancelLoading(e.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -164,6 +156,20 @@ public class ShopChest extends JavaPlugin {
|
||||
updater.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the plugin and load the reason.
|
||||
*
|
||||
* @param reason The reason to log
|
||||
*/
|
||||
private void cancelLoading(String reason) {
|
||||
final String disableMessage = "Disabling the plugin";
|
||||
debugLogger.debug(reason);
|
||||
debugLogger.debug(disableMessage);
|
||||
debugLogger.getLogger().warning(reason);
|
||||
debugLogger.getLogger().warning(disableMessage);
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
debugLogger.debug("Disabling ShopChest...");
|
||||
|
Loading…
Reference in New Issue
Block a user