Vault not recognizing integration
imreallyliam opened this issue ยท 3 comments
I am developing an economy plugin for Vault. I have implemented the Economy class into my class and have in the main class ran new EconomyAPI(this);
, however, it still doesn't register. If you check my constructor, it runs the ServiceManager.
`package org.rbstudios.cloud.resources;
import java.util.List;
import org.bukkit.OfflinePlayer;
import org.bukkit.plugin.ServicePriority;
import org.rbstudios.cloud.Cloud;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
public class EconomyAPI implements Economy {
Cloud pl;
public EconomyAPI(Cloud t) {
pl = t;
pl.getServer().getServicesManager().register(Economy.class, this, pl.getServer().getPluginManager().getPlugin("Vault"), ServicePriority.Normal);
}
@Override
public EconomyResponse bankBalance(String arg0) {
return null;
}
@Override
public EconomyResponse bankDeposit(String arg0, double arg1) {
return null;
}
@Override
public EconomyResponse bankHas(String arg0, double arg1) {
return null;
}
@Override
public EconomyResponse bankWithdraw(String arg0, double arg1) {
return null;
}
@Override
public EconomyResponse createBank(String arg0, String arg1) {
return null;
}
@Override
public EconomyResponse createBank(String arg0, OfflinePlayer arg1) {
return null;
}
@Override
public boolean createPlayerAccount(String arg0) {
return false;
}
@Override
public boolean createPlayerAccount(OfflinePlayer arg0) {
return false;
}
@Override
public boolean createPlayerAccount(String arg0, String arg1) {
return false;
}
@Override
public boolean createPlayerAccount(OfflinePlayer arg0, String arg1) {
return false;
}
@Override
public String currencyNamePlural() {
return null;
}
@Override
public String currencyNameSingular() {
return null;
}
@Override
public EconomyResponse deleteBank(String arg0) {
return null;
}
@Override
public EconomyResponse depositPlayer(String arg0, double arg1) {
return null;
}
@Override
public EconomyResponse depositPlayer(OfflinePlayer arg0, double arg1) {
return null;
}
@Override
public EconomyResponse depositPlayer(String arg0, String arg1, double arg2) {
return null;
}
@Override
public EconomyResponse depositPlayer(OfflinePlayer arg0, String arg1, double arg2) {
return null;
}
@Override
public String format(double arg0) {
return null;
}
@Override
public int fractionalDigits() {
return 0;
}
@Override
public double getBalance(String arg0) {
return 0;
}
@Override
public double getBalance(OfflinePlayer arg0) {
return 0;
}
@Override
public double getBalance(String arg0, String arg1) {
return 0;
}
@Override
public double getBalance(OfflinePlayer arg0, String arg1) {
return 0;
}
@Override
public List<String> getBanks() {
return null;
}
@Override
public String getName() {
return null;
}
@Override
public boolean has(String arg0, double arg1) {
return false;
}
@Override
public boolean has(OfflinePlayer arg0, double arg1) {
return false;
}
@Override
public boolean has(String arg0, String arg1, double arg2) {
return false;
}
@Override
public boolean has(OfflinePlayer arg0, String arg1, double arg2) {
return false;
}
@Override
public boolean hasAccount(String arg0) {
return false;
}
@Override
public boolean hasAccount(OfflinePlayer arg0) {
return false;
}
@Override
public boolean hasAccount(String arg0, String arg1) {
return false;
}
@Override
public boolean hasAccount(OfflinePlayer arg0, String arg1) {
return false;
}
@Override
public boolean hasBankSupport() {
return false;
}
@Override
public EconomyResponse isBankMember(String arg0, String arg1) {
return null;
}
@Override
public EconomyResponse isBankMember(String arg0, OfflinePlayer arg1) {
return null;
}
@Override
public EconomyResponse isBankOwner(String arg0, String arg1) {
return null;
}
@Override
public EconomyResponse isBankOwner(String arg0, OfflinePlayer arg1) {
return null;
}
@Override
public boolean isEnabled() {
return false;
}
@Override
public EconomyResponse withdrawPlayer(String arg0, double arg1) {
return null;
}
@Override
public EconomyResponse withdrawPlayer(OfflinePlayer arg0, double arg1) {
return null;
}
@Override
public EconomyResponse withdrawPlayer(String arg0, String arg1, double arg2) {
return null;
}
@Override
public EconomyResponse withdrawPlayer(OfflinePlayer arg0, String arg1, double arg2) {
return null;
}
}
`
This is the code I have now, it says it's hooked, however, when I run /vault-info, it displays null...
`
package org.rbstudios.cloud.resources;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.plugin.Plugin;
import org.rbstudios.cloud.Cloud;
import net.milkbowl.vault.economy.AbstractEconomy;
import net.milkbowl.vault.economy.EconomyResponse;
public class Economy_Cloud extends AbstractEconomy {
Cloud pl;
private final String name = "Cloud";
private Plugin plugin = null;
private Cloud econ = null;
public Economy_Cloud(Cloud t, Plugin plugin) {
pl = t;
this.plugin = plugin;
Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin);
if (econ == null) {
Plugin econ = plugin.getServer().getPluginManager().getPlugin("Cloud");
if (econ != null && econ.isEnabled()) {
this.econ = (Cloud) econ;
pl.log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name));
}
}
}
public class EconomyServerListener implements Listener {
Economy_Cloud economy = null;
public EconomyServerListener(Economy_Cloud economy) {
this.economy = economy;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (economy.econ == null) {
Plugin eco = event.getPlugin();
if (eco.getDescription().getName().equals("Cloud")) {
economy.econ = (Cloud) eco;
pl.log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
}
}
}
}
@Override
public EconomyResponse bankBalance(String arg0) {
return null;
}
@Override
public EconomyResponse bankDeposit(String arg0, double arg1) {
return null;
}
@Override
public EconomyResponse bankHas(String arg0, double arg1) {
return null;
}
@Override
public EconomyResponse bankWithdraw(String arg0, double arg1) {
return null;
}
@Override
public EconomyResponse createBank(String arg0, String arg1) {
return null;
}
@Override
public boolean createPlayerAccount(String arg0) {
return false;
}
@Override
public boolean createPlayerAccount(String arg0, String arg1) {
return false;
}
@Override
public String currencyNamePlural() {
return null;
}
@Override
public String currencyNameSingular() {
return null;
}
@Override
public EconomyResponse deleteBank(String arg0) {
return null;
}
@Override
public EconomyResponse depositPlayer(String arg0, double arg1) {
return null;
}
@Override
public EconomyResponse depositPlayer(String arg0, String arg1, double arg2) {
return null;
}
@Override
public String format(double arg0) {
return null;
}
@Override
public int fractionalDigits() {
return 0;
}
@Override
public double getBalance(String arg0) {
return 0;
}
@Override
public double getBalance(String arg0, String arg1) {
return 0;
}
@Override
public List<String> getBanks() {
return null;
}
@Override
public String getName() {
return null;
}
@Override
public boolean has(String arg0, double arg1) {
return false;
}
@Override
public boolean has(String arg0, String arg1, double arg2) {
return false;
}
@Override
public boolean hasAccount(String arg0) {
return false;
}
@Override
public boolean hasAccount(String arg0, String arg1) {
return false;
}
@Override
public boolean hasBankSupport() {
return false;
}
@Override
public EconomyResponse isBankMember(String arg0, String arg1) {
return null;
}
@Override
public EconomyResponse isBankOwner(String arg0, String arg1) {
return null;
}
@Override
public boolean isEnabled() {
return false;
}
@Override
public EconomyResponse withdrawPlayer(String arg0, double arg1) {
return null;
}
@Override
public EconomyResponse withdrawPlayer(String arg0, String arg1, double arg2) {
return null;
}
}
`
I added Bukkit.getServicesManager().register(Economy.class, this, Bukkit.getPluginManager().getPlugin("Vault"), ServicePriority.Normal);
and now it displays "null [null]" instead of "None [None]"