Minor cleanup of the economy helper class
This commit is contained in:
parent
3717e4d3b6
commit
d624bb5103
@ -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 <p>An economy instance, or null if it's not initialized</p>
|
||||
@ -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<Economy> economyProvider = server.getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
|
||||
RegisteredServiceProvider<Economy> economyProvider = servicesManager.getRegistration(Economy.class);
|
||||
if (economyProvider != null) {
|
||||
economy = economyProvider.getProvider();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user