fix improper formatting on gringotts, and incorrect jdocs. Jdocs are

not to be used in implementing classes as the return values MUST match
what the jdoc/parent class defines.
This commit is contained in:
Sleaker 2012-08-08 20:44:27 -07:00
parent 54252e65a6
commit deefa25dfb

View File

@ -33,7 +33,6 @@ import org.bukkit.plugin.Plugin;
import org.gestern.gringotts.Account;
import org.gestern.gringotts.AccountHolder;
import org.gestern.gringotts.Gringotts;
import org.gestern.gringotts.PlayerAccountHolder;
public class Economy_Gringotts implements Economy {
@ -86,80 +85,42 @@ public class Economy_Gringotts implements Economy {
}
}
/**
* Checks if economy method is enabled.
* @return Success or Failure
*/
@Override
public boolean isEnabled(){
return gringotts != null && gringotts.isEnabled();
}
/**
* Gets name of permission method
* @return Name of Permission Method
*/
@Override
public String getName() {
return name;
}
/**
* Returns true if the given implementation supports banks.
* @return true if the implementation supports banks
*/
@Override
public boolean hasBankSupport(){
return false;
}
/**
* Some economy plugins round off after a certain number of digits.
* This function returns the number of digits the plugin keeps
* or -1 if no rounding occurs.
* @return number of digits after the decimal point kept
*/
@Override
public int fractionalDigits(){
return 2;
}
/**
* Format amount into a human readable String This provides translation into
* economy specific formatting to improve consistency between plugins.
*
* @param amount
* @return Human readable string describing amount
*/
@Override
public String format(double amount) {
// TODO 2-digit formatting
return Double.toString(amount);
}
/**
* Returns the name of the currency in plural form.
* If the economy being used does not support currency names then an empty string will be returned.
*
* @return name of the currency (plural)
*/
@Override
public String currencyNamePlural(){
return org.gestern.gringotts.Configuration.config.currencyNamePlural;
}
/**
* Returns the name of the currency in singular form.
* If the economy being used does not support currency names then an empty string will be returned.
*
* @return name of the currency (singular)
*/
@Override
public String currencyNameSingular(){
return org.gestern.gringotts.Configuration.config.currencyNameSingular;
}
/**
* Checks if this player or entity has an account on the server yet.
* This will always return true if the player has joined the server at least once
* as all major economy plugins auto-generate a player account when the player joins the server.
* @param playerName
* @return if the player has an account
*/
@Override
public boolean hasAccount(String playerName) {
AccountHolder owner = gringotts.accountHolderFactory.getAccount(playerName);
if (owner == null) return false;
@ -167,12 +128,7 @@ public class Economy_Gringotts implements Economy {
return gringotts.accounting.getAccount(owner) != null;
}
/**
* Gets balance of a player
* @param playerName
* @return Amount currently held in players account
*/
@Override
public double getBalance(String playerName){
AccountHolder owner = gringotts.accountHolderFactory.getAccount(playerName);
if (owner == null) return 0;
@ -180,25 +136,12 @@ public class Economy_Gringotts implements Economy {
return account.balance();
}
/**
* Checks if the player account has the amount - DO NOT USE NEGATIVE AMOUNTS
*
* @param playerName
* @param amount
* @return
* @throws UserDoesNotExistException
*/
@Override
public boolean has(String playerName, double amount) {
return getBalance(playerName) >= amount;
}
/**
* Withdraw an amount from a player - DO NOT USE NEGATIVE AMOUNTS
*
* @param playerName Name of player
* @param amount Amount to withdraw
* @return Detailed response of transaction
*/
@Override
public EconomyResponse withdrawPlayer(String playerName, double amount) {
if( amount < 0 ) {
@ -221,13 +164,7 @@ public class Economy_Gringotts implements Economy {
}
/**
* Deposit an amount to a player - DO NOT USE NEGATIVE AMOUNTS
*
* @param playerName Name of player
* @param amount Amount to deposit
* @return Detailed response of transaction
*/
@Override
public EconomyResponse depositPlayer(String playerName, double amount){
if (amount < 0) {
return new EconomyResponse(0, 0, ResponseType.FAILURE, "Cannot desposit negative funds");
@ -246,99 +183,52 @@ public class Economy_Gringotts implements Economy {
}
/**
* Creates a bank account with the specified name and the player as the owner
* @param name
* @param player
* @return
*/
@Override
public EconomyResponse createBank(String name, String player) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Gringotts does not support bank accounts!");
}
/**
* Deletes a bank account with the specified name.
* @param name
* @return if the operation completed successfully
*/
@Override
public EconomyResponse deleteBank(String name) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Gringotts does not support bank accounts!");
}
/**
* Returns the amount the bank has
* @param name
* @return
*/
@Override
public EconomyResponse bankBalance(String name) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Gringotts does not support bank accounts!");
}
/**
* Returns true or false whether the bank has the amount specified - DO NOT USE NEGATIVE AMOUNTS
*
* @param name
* @param amount
* @return
*/
@Override
public EconomyResponse bankHas(String name, double amount) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Gringotts does not support bank accounts!");
}
/**
* Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTS
*
* @param name
* @param amount
* @return
*/
@Override
public EconomyResponse bankWithdraw(String name, double amount) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Gringotts does not support bank accounts!");
}
/**
* Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTS
*
* @param name
* @param amount
* @return
*/
@Override
public EconomyResponse bankDeposit(String name, double amount) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Gringotts does not support bank accounts!");
}
/**
* Check if a player is the owner of a bank account
* @param name
* @param playerName
* @return
*/
@Override
public EconomyResponse isBankOwner(String name, String playerName) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Gringotts does not support bank accounts!");
}
/**
* Check if the player is a member of the bank account
* @param name
* @param playerName
* @return
*/
@Override
public EconomyResponse isBankMember(String name, String playerName) {
return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Gringotts does not support bank accounts!");
}
/**
* Gets the list of banks
* @return the List of Banks
*/
@Override
public List<String> getBanks() {
return new ArrayList<String>();
}
/**
* Attempts to create a player account for the given player
* @return if the account creation was successful
*/
@Override
public boolean createPlayerAccount(String playerName) {
return hasAccount(playerName);
}