Created
April 11, 2021 12:41
-
-
Save mtbarr/d2bedc01e06369db5dc52e398988fad7 to your computer and use it in GitHub Desktop.
Economy implementation with less boilerplate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import net.milkbowl.vault.economy.Economy; | |
import net.milkbowl.vault.economy.EconomyResponse; | |
import org.bukkit.OfflinePlayer; | |
import java.util.Collections; | |
import java.util.List; | |
public abstract class EconomyWrapper implements Economy { | |
public boolean hasBankSupport() { | |
return false; | |
} | |
@Override | |
public String currencyNamePlural() { | |
return ""; | |
} | |
@Override | |
public String currencyNameSingular() { | |
return ""; | |
} | |
@Override | |
public boolean hasAccount(OfflinePlayer player) { | |
return hasAccount(player.getName()); | |
} | |
@Override | |
public boolean hasAccount(String playerName, String worldName) { | |
return hasAccount(playerName); | |
} | |
@Override | |
public boolean hasAccount(OfflinePlayer player, String worldName) { | |
return hasAccount(player); | |
} | |
@Override | |
public boolean has(String playerName, double amount) { | |
return getBalance(playerName) >= amount; | |
} | |
@Override | |
public double getBalance(OfflinePlayer player) { | |
return getBalance(player.getName()); | |
} | |
@Override | |
public double getBalance(String playerName, String world) { | |
return getBalance(playerName); | |
} | |
@Override | |
public double getBalance(OfflinePlayer player, String world) { | |
return getBalance(player); | |
} | |
@Override | |
public boolean has(OfflinePlayer player, double amount) { | |
return has(player.getName() , amount); | |
} | |
@Override | |
public boolean has(String playerName, String worldName, double amount) { | |
return has(playerName, amount); | |
} | |
@Override | |
public boolean has(OfflinePlayer player, String worldName, double amount) { | |
return has(player, amount); | |
} | |
@Override | |
public EconomyResponse withdrawPlayer(OfflinePlayer player, double amount) { | |
return withdrawPlayer(player.getName() , amount); | |
} | |
@Override | |
public EconomyResponse withdrawPlayer(String playerName, String worldName, double amount) { | |
return withdrawPlayer(playerName , amount); | |
} | |
@Override | |
public EconomyResponse withdrawPlayer(OfflinePlayer player, String worldName, double amount) { | |
return withdrawPlayer(player , amount); | |
} | |
@Override | |
public EconomyResponse depositPlayer(OfflinePlayer player, double amount) { | |
return depositPlayer(player.getName() , amount); | |
} | |
@Override | |
public EconomyResponse depositPlayer(String playerName, String worldName, double amount) { | |
return depositPlayer(playerName, amount); | |
} | |
@Override | |
public EconomyResponse depositPlayer(OfflinePlayer player, String worldName, double amount) { | |
return depositPlayer(player, amount); | |
} | |
@Override | |
public EconomyResponse createBank(String name, String player) { | |
return new EconomyResponse( 0 , 0 , EconomyResponse.ResponseType.NOT_IMPLEMENTED , null); | |
} | |
@Override | |
public EconomyResponse createBank(String name, OfflinePlayer player) { | |
return createBank(name , player.getName()); | |
} | |
@Override | |
public EconomyResponse deleteBank(String name) { | |
return new EconomyResponse( 0 , 0 , EconomyResponse.ResponseType.NOT_IMPLEMENTED , null); | |
} | |
@Override | |
public EconomyResponse bankBalance(String name) { | |
return new EconomyResponse( 0 , 0 , EconomyResponse.ResponseType.NOT_IMPLEMENTED , null); | |
} | |
@Override | |
public EconomyResponse bankHas(String name, double amount) { | |
return new EconomyResponse( 0 , 0 , EconomyResponse.ResponseType.NOT_IMPLEMENTED , null); | |
} | |
@Override | |
public EconomyResponse bankWithdraw(String name, double amount) { | |
return new EconomyResponse( 0 , 0 , EconomyResponse.ResponseType.NOT_IMPLEMENTED , null); | |
} | |
@Override | |
public EconomyResponse bankDeposit(String name, double amount) { | |
return new EconomyResponse( 0 , 0 , EconomyResponse.ResponseType.NOT_IMPLEMENTED , null); | |
} | |
@Override | |
public EconomyResponse isBankOwner(String name, String playerName) { | |
return new EconomyResponse( 0 , 0 , EconomyResponse.ResponseType.NOT_IMPLEMENTED , null); | |
} | |
@Override | |
public EconomyResponse isBankOwner(String name, OfflinePlayer player) { | |
return new EconomyResponse( 0 , 0 , EconomyResponse.ResponseType.NOT_IMPLEMENTED , null); | |
} | |
@Override | |
public EconomyResponse isBankMember(String name, String playerName) { | |
return new EconomyResponse( 0 , 0 , EconomyResponse.ResponseType.NOT_IMPLEMENTED , null); | |
} | |
@Override | |
public EconomyResponse isBankMember(String name, OfflinePlayer player) { | |
return new EconomyResponse( 0 , 0 , EconomyResponse.ResponseType.NOT_IMPLEMENTED , null); | |
} | |
@Override | |
public List<String> getBanks() { | |
return Collections.emptyList(); | |
} | |
@Override | |
public boolean createPlayerAccount(OfflinePlayer player) { | |
return createPlayerAccount(player.getName()); | |
} | |
@Override | |
public boolean createPlayerAccount(String playerName, String worldName) { | |
return createPlayerAccount(playerName); | |
} | |
@Override | |
public boolean createPlayerAccount(OfflinePlayer player, String worldName) { | |
return createPlayerAccount(player); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment