BREAKING CHANGE: abstracted the Economy interface.

This commit is contained in:
Sleaker 2013-01-19 10:55:33 -08:00
parent f6cee62506
commit 5fbdd4fa7f
24 changed files with 46 additions and 46 deletions

View File

@ -22,25 +22,25 @@ import java.util.List;
* The main economy API * The main economy API
* *
*/ */
public interface Economy { public abstract class Economy {
/** /**
* Checks if economy method is enabled. * Checks if economy method is enabled.
* @return Success or Failure * @return Success or Failure
*/ */
public boolean isEnabled(); public abstract boolean isEnabled();
/** /**
* Gets name of permission method * Gets name of permission method
* @return Name of Permission Method * @return Name of Permission Method
*/ */
public String getName(); public abstract String getName();
/** /**
* Returns true if the given implementation supports banks. * Returns true if the given implementation supports banks.
* @return true if the implementation supports banks * @return true if the implementation supports banks
*/ */
public boolean hasBankSupport(); public abstract boolean hasBankSupport();
/** /**
* Some economy plugins round off after a certain number of digits. * Some economy plugins round off after a certain number of digits.
@ -48,7 +48,7 @@ public interface Economy {
* or -1 if no rounding occurs. * or -1 if no rounding occurs.
* @return number of digits after the decimal point kept * @return number of digits after the decimal point kept
*/ */
public int fractionalDigits(); public abstract int fractionalDigits();
/** /**
* Format amount into a human readable String This provides translation into * Format amount into a human readable String This provides translation into
@ -57,7 +57,7 @@ public interface Economy {
* @param amount * @param amount
* @return Human readable string describing amount * @return Human readable string describing amount
*/ */
public String format(double amount); public abstract String format(double amount);
/** /**
* Returns the name of the currency in plural form. * Returns the name of the currency in plural form.
@ -65,7 +65,7 @@ public interface Economy {
* *
* @return name of the currency (plural) * @return name of the currency (plural)
*/ */
public String currencyNamePlural(); public abstract String currencyNamePlural();
/** /**
@ -74,7 +74,7 @@ public interface Economy {
* *
* @return name of the currency (singular) * @return name of the currency (singular)
*/ */
public String currencyNameSingular(); public abstract String currencyNameSingular();
/** /**
* Checks if this player has an account on the server yet * Checks if this player has an account on the server yet
@ -83,7 +83,7 @@ public interface Economy {
* @param playerName * @param playerName
* @return if the player has an account * @return if the player has an account
*/ */
public boolean hasAccount(String playerName); public abstract boolean hasAccount(String playerName);
/** /**
@ -91,7 +91,7 @@ public interface Economy {
* @param playerName * @param playerName
* @return Amount currently held in players account * @return Amount currently held in players account
*/ */
public double getBalance(String playerName); public abstract double getBalance(String playerName);
/** /**
* Checks if the player account has the amount - DO NOT USE NEGATIVE AMOUNTS * Checks if the player account has the amount - DO NOT USE NEGATIVE AMOUNTS
@ -100,7 +100,7 @@ public interface Economy {
* @param amount * @param amount
* @return True if <b>playerName</b> has <b>amount</b>, False else wise * @return True if <b>playerName</b> has <b>amount</b>, False else wise
*/ */
public boolean has(String playerName, double amount); public abstract boolean has(String playerName, double amount);
/** /**
* Withdraw an amount from a player - DO NOT USE NEGATIVE AMOUNTS * Withdraw an amount from a player - DO NOT USE NEGATIVE AMOUNTS
@ -109,7 +109,7 @@ public interface Economy {
* @param amount Amount to withdraw * @param amount Amount to withdraw
* @return Detailed response of transaction * @return Detailed response of transaction
*/ */
public EconomyResponse withdrawPlayer(String playerName, double amount); public abstract EconomyResponse withdrawPlayer(String playerName, double amount);
/** /**
* Deposit an amount to a player - DO NOT USE NEGATIVE AMOUNTS * Deposit an amount to a player - DO NOT USE NEGATIVE AMOUNTS
@ -118,7 +118,7 @@ public interface Economy {
* @param amount Amount to deposit * @param amount Amount to deposit
* @return Detailed response of transaction * @return Detailed response of transaction
*/ */
public EconomyResponse depositPlayer(String playerName, double amount); public abstract EconomyResponse depositPlayer(String playerName, double amount);
/** /**
* Creates a bank account with the specified name and the player as the owner * Creates a bank account with the specified name and the player as the owner
@ -126,21 +126,21 @@ public interface Economy {
* @param player * @param player
* @return EconomyResponse Object * @return EconomyResponse Object
*/ */
public EconomyResponse createBank(String name, String player); public abstract EconomyResponse createBank(String name, String player);
/** /**
* Deletes a bank account with the specified name. * Deletes a bank account with the specified name.
* @param name * @param name
* @return if the operation completed successfully * @return if the operation completed successfully
*/ */
public EconomyResponse deleteBank(String name); public abstract EconomyResponse deleteBank(String name);
/** /**
* Returns the amount the bank has * Returns the amount the bank has
* @param name * @param name
* @return EconomyResponse Object * @return EconomyResponse Object
*/ */
public EconomyResponse bankBalance(String name); public abstract EconomyResponse bankBalance(String name);
/** /**
* Returns true or false whether the bank has the amount specified - DO NOT USE NEGATIVE AMOUNTS * Returns true or false whether the bank has the amount specified - DO NOT USE NEGATIVE AMOUNTS
@ -149,7 +149,7 @@ public interface Economy {
* @param amount * @param amount
* @return EconomyResponse Object * @return EconomyResponse Object
*/ */
public EconomyResponse bankHas(String name, double amount); public abstract EconomyResponse bankHas(String name, double amount);
/** /**
* Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTS * Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTS
@ -158,7 +158,7 @@ public interface Economy {
* @param amount * @param amount
* @return EconomyResponse Object * @return EconomyResponse Object
*/ */
public EconomyResponse bankWithdraw(String name, double amount); public abstract EconomyResponse bankWithdraw(String name, double amount);
/** /**
* Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTS * Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTS
@ -167,7 +167,7 @@ public interface Economy {
* @param amount * @param amount
* @return EconomyResponse Object * @return EconomyResponse Object
*/ */
public EconomyResponse bankDeposit(String name, double amount); public abstract EconomyResponse bankDeposit(String name, double amount);
/** /**
* Check if a player is the owner of a bank account * Check if a player is the owner of a bank account
@ -175,7 +175,7 @@ public interface Economy {
* @param playerName * @param playerName
* @return EconomyResponse Object * @return EconomyResponse Object
*/ */
public EconomyResponse isBankOwner(String name, String playerName); public abstract EconomyResponse isBankOwner(String name, String playerName);
/** /**
* Check if the player is a member of the bank account * Check if the player is a member of the bank account
@ -183,17 +183,17 @@ public interface Economy {
* @param playerName * @param playerName
* @return EconomyResponse Object * @return EconomyResponse Object
*/ */
public EconomyResponse isBankMember(String name, String playerName); public abstract EconomyResponse isBankMember(String name, String playerName);
/** /**
* Gets the list of banks * Gets the list of banks
* @return the List of Banks * @return the List of Banks
*/ */
public List<String> getBanks(); public abstract List<String> getBanks();
/** /**
* Attempts to create a player account for the given player * Attempts to create a player account for the given player
* @return if the account creation was successful * @return if the account creation was successful
*/ */
public boolean createPlayerAccount(String playerName); public abstract boolean createPlayerAccount(String playerName);
} }

View File

@ -34,7 +34,7 @@ import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
public class Economy_3co implements Economy { public class Economy_3co extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "3co"; private final String name = "3co";

View File

@ -35,7 +35,7 @@ import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.neocraft.AEco.AEco; import org.neocraft.AEco.AEco;
public class Economy_AEco implements Economy { public class Economy_AEco extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "AEco"; private final String name = "AEco";

View File

@ -34,7 +34,7 @@ import org.bukkit.plugin.Plugin;
import cosine.boseconomy.BOSEconomy; import cosine.boseconomy.BOSEconomy;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class Economy_BOSE6 implements Economy { public class Economy_BOSE6 extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "BOSEconomy"; private final String name = "BOSEconomy";

View File

@ -32,7 +32,7 @@ import org.bukkit.plugin.Plugin;
import cosine.boseconomy.BOSEconomy; import cosine.boseconomy.BOSEconomy;
public class Economy_BOSE7 implements Economy { public class Economy_BOSE7 extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "BOSEconomy"; private final String name = "BOSEconomy";

View File

@ -18,7 +18,7 @@ import com.github.zathrus_writer.commandsex.api.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse; import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.economy.EconomyResponse.ResponseType; import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
public class Economy_CommandsEX implements net.milkbowl.vault.economy.Economy { public class Economy_CommandsEX extends net.milkbowl.vault.economy.Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "CommandsEX Economy"; private final String name = "CommandsEX Economy";

View File

@ -38,7 +38,7 @@ import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
public class Economy_Craftconomy implements Economy { public class Economy_Craftconomy extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "Craftconomy"; private final String name = "Craftconomy";

View File

@ -38,7 +38,7 @@ import com.greatmancode.craftconomy3.account.Account;
import com.greatmancode.craftconomy3.currency.CurrencyManager; import com.greatmancode.craftconomy3.currency.CurrencyManager;
import com.greatmancode.craftconomy3.database.tables.AccountTable; import com.greatmancode.craftconomy3.database.tables.AccountTable;
public class Economy_Craftconomy3 implements Economy { public class Economy_Craftconomy3 extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "Craftconomy3"; private final String name = "Craftconomy3";

View File

@ -33,7 +33,7 @@ import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
public class Economy_CurrencyCore implements Economy { public class Economy_CurrencyCore extends Economy {
private Currency currency; private Currency currency;
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");

View File

@ -26,7 +26,7 @@ import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse; import net.milkbowl.vault.economy.EconomyResponse;
public class Economy_Dosh implements Economy { public class Economy_Dosh extends Economy {
Plugin plugin; Plugin plugin;

View File

@ -35,7 +35,7 @@ import org.bukkit.plugin.Plugin;
import ca.agnate.EconXP.EconXP; import ca.agnate.EconXP.EconXP;
public class Economy_EconXP implements Economy { public class Economy_EconXP extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "EconXP"; private final String name = "EconXP";

View File

@ -35,7 +35,7 @@ import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.api.NoLoanPermittedException; import com.earth2me.essentials.api.NoLoanPermittedException;
import com.earth2me.essentials.api.UserDoesNotExistException; import com.earth2me.essentials.api.UserDoesNotExistException;
public class Economy_Essentials implements Economy { public class Economy_Essentials extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "Essentials Economy"; private final String name = "Essentials Economy";

View File

@ -33,7 +33,7 @@ import org.bukkit.plugin.Plugin;
import com.flobi.GoldIsMoney.GoldIsMoney; import com.flobi.GoldIsMoney.GoldIsMoney;
public class Economy_GoldIsMoney implements Economy { public class Economy_GoldIsMoney extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "GoldIsMoney"; private final String name = "GoldIsMoney";

View File

@ -32,7 +32,7 @@ import org.bukkit.plugin.Plugin;
import com.flobi.GoldIsMoney2.GoldIsMoney; import com.flobi.GoldIsMoney2.GoldIsMoney;
public class Economy_GoldIsMoney2 implements Economy { public class Economy_GoldIsMoney2 extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "GoldIsMoney"; private final String name = "GoldIsMoney";

View File

@ -34,7 +34,7 @@ import org.gestern.gringotts.Account;
import org.gestern.gringotts.AccountHolder; import org.gestern.gringotts.AccountHolder;
import org.gestern.gringotts.Gringotts; import org.gestern.gringotts.Gringotts;
public class Economy_Gringotts implements Economy { public class Economy_Gringotts extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");

View File

@ -33,7 +33,7 @@ import org.bukkit.plugin.Plugin;
import boardinggamer.mcmoney.McMoneyAPI; import boardinggamer.mcmoney.McMoneyAPI;
public class Economy_McMoney implements Economy { public class Economy_McMoney extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "McMoney"; private final String name = "McMoney";

View File

@ -36,7 +36,7 @@ import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
public class Economy_MineConomy implements Economy { public class Economy_MineConomy extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "MineConomy"; private final String name = "MineConomy";

View File

@ -33,7 +33,7 @@ import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
public class Economy_MultiCurrency implements Economy { public class Economy_MultiCurrency extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "MultiCurrency"; private final String name = "MultiCurrency";

View File

@ -31,7 +31,7 @@ import com.github.omwah.SDFEconomy.SDFEconomyAPI;
import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse; import net.milkbowl.vault.economy.EconomyResponse;
public class Economy_SDFEconomy implements Economy { public class Economy_SDFEconomy extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private Plugin plugin = null; private Plugin plugin = null;

View File

@ -33,7 +33,7 @@ import org.bukkit.plugin.Plugin;
import com.gmail.mirelatrue.xpbank.XPBank; import com.gmail.mirelatrue.xpbank.XPBank;
public class Economy_XPBank implements Economy { public class Economy_XPBank extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "XPBank"; private final String name = "XPBank";

View File

@ -32,7 +32,7 @@ import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
public class Economy_eWallet implements Economy { public class Economy_eWallet extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "eWallet"; private final String name = "eWallet";

View File

@ -35,7 +35,7 @@ import org.bukkit.plugin.Plugin;
import com.nijiko.coelho.iConomy.iConomy; import com.nijiko.coelho.iConomy.iConomy;
import com.nijiko.coelho.iConomy.system.Account; import com.nijiko.coelho.iConomy.system.Account;
public class Economy_iConomy4 implements Economy { public class Economy_iConomy4 extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "iConomy 4"; private final String name = "iConomy 4";

View File

@ -35,7 +35,7 @@ import com.iConomy.iConomy;
import com.iConomy.system.Holdings; import com.iConomy.system.Holdings;
import com.iConomy.util.Constants; import com.iConomy.util.Constants;
public class Economy_iConomy5 implements Economy { public class Economy_iConomy5 extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private final String name = "iConomy 5"; private final String name = "iConomy 5";

View File

@ -35,7 +35,7 @@ import com.iCo6.iConomy;
import com.iCo6.system.Accounts; import com.iCo6.system.Accounts;
import com.iCo6.system.Holdings; import com.iCo6.system.Holdings;
public class Economy_iConomy6 implements Economy { public class Economy_iConomy6 extends Economy {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private String name = "iConomy "; private String name = "iConomy ";