From d624bb51031a8c192995dd8daab6298a8b3c64d5 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Thu, 2 Sep 2021 01:34:06 +0200 Subject: [PATCH] Minor cleanup of the economy helper class --- .../bookswithoutborders/utility/EconomyHelper.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/knarcraft/bookswithoutborders/utility/EconomyHelper.java b/src/main/java/net/knarcraft/bookswithoutborders/utility/EconomyHelper.java index f580da7..8f26935 100644 --- a/src/main/java/net/knarcraft/bookswithoutborders/utility/EconomyHelper.java +++ b/src/main/java/net/knarcraft/bookswithoutborders/utility/EconomyHelper.java @@ -6,11 +6,19 @@ import org.bukkit.Server; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.RegisteredServiceProvider; +import org.bukkit.plugin.ServicesManager; -public class EconomyHelper { +/** + * Helper class for economy related functions + */ +public final class EconomyHelper { private static Economy economy; + private EconomyHelper() { + + } + /** * Gets an economy instance for making transactions * @return

An economy instance, or null if it's not initialized

@@ -30,9 +38,10 @@ public class EconomyHelper { Server server = BooksWithoutBorders.getInstance().getServer(); Plugin plugin = server.getPluginManager().getPlugin("Vault"); + ServicesManager servicesManager = server.getServicesManager(); if (plugin != null) { - RegisteredServiceProvider economyProvider = server.getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class); + RegisteredServiceProvider economyProvider = servicesManager.getRegistration(Economy.class); if (economyProvider != null) { economy = economyProvider.getProvider(); }