public class Currency
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Currency.TransactionHandler |
| Modifier and Type | Field and Description |
|---|---|
static java.util.Map<java.lang.String,Currency> |
currencies |
| Constructor and Description |
|---|
Currency(org.bukkit.plugin.Plugin plugin,
java.lang.String name,
int digits,
int startBalance)
Creates a new Currency
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBalance(org.bukkit.entity.Player p,
double amount)
Adds to the Players Balance
|
void |
addBalance(java.util.UUID uuid,
double amount)
Adds to the Players Balance
|
double |
getBalance(org.bukkit.entity.Player p)
Returns the Balance of a Player
|
double |
getBalance(java.util.UUID uuid)
Returns the Balance of a Player
|
static Currency |
getByName(java.lang.String name)
Returns a registered Currency with that Name
|
java.lang.String |
getPriceTag(org.bukkit.entity.Player p,
double cost)
Automatically colors the specified Cost in green
or red depending on whether the Player has enough
Money or not
|
static java.util.Collection<Currency> |
list()
Returns all registered Currencies
|
boolean |
purchase(org.bukkit.entity.Player p,
double amount)
Returns whether someone has enough Money to buy something
If he does, the Balance will be removed automatically
|
void |
registerTransactionHandler(Currency.TransactionHandler handler)
Registers a Handler to be listening to an Event
|
void |
removeBalance(org.bukkit.entity.Player p,
double amount)
Removes from the Players Balance
|
void |
removeBalance(java.util.UUID uuid,
double amount)
Removes from the Players Balance
|
void |
resetBalance(org.bukkit.entity.Player p)
Resets the Players Balance
|
void |
resetBalance(java.util.UUID uuid)
Resets the Players Balance
|
void |
setBalance(org.bukkit.entity.Player p,
double balance)
Sets the Balance of a Player to the specified Amount
|
void |
setBalance(java.util.UUID uuid,
double balance)
Sets the Balance of a Player to the specified Amount
|
public static java.util.Map<java.lang.String,Currency> currencies
public Currency(org.bukkit.plugin.Plugin plugin,
java.lang.String name,
int digits,
int startBalance)
plugin - The Instance of the Plugin which this Currency is made forname - The Name of this Currencydigits - How many digits an amount might havestartBalance - The Balance which every Player will start withpublic void registerTransactionHandler(Currency.TransactionHandler handler)
handler - The Handler used upon a Players Balance changingpublic void setBalance(org.bukkit.entity.Player p,
double balance)
p - The Player whose Balance will be setbalance - The new Balance for this Playerpublic void setBalance(java.util.UUID uuid,
double balance)
p - The Player whose Balance will be setbalance - The new Balance for this Playerpublic double getBalance(org.bukkit.entity.Player p)
p - The Player whose Balance you want to getpublic double getBalance(java.util.UUID uuid)
p - The Player whose Balance you want to getpublic void addBalance(org.bukkit.entity.Player p,
double amount)
p - The Player whose Balance will be modifiedamount - The Amount which will be depositedpublic void addBalance(java.util.UUID uuid,
double amount)
p - The Player whose Balance will be modifiedamount - The Amount which will be depositedpublic void removeBalance(org.bukkit.entity.Player p,
double amount)
p - The Player whose Balance will be modifiedamount - The Amount which will be withdrawnpublic void removeBalance(java.util.UUID uuid,
double amount)
p - The Player whose Balance will be modifiedamount - The Amount which will be withdrawnpublic void resetBalance(org.bukkit.entity.Player p)
p - The Player whose Balance will be resetpublic void resetBalance(java.util.UUID uuid)
p - The Player whose Balance will be resetpublic boolean purchase(org.bukkit.entity.Player p,
double amount)
p - The Player whose Balance you want to checkamount - The Amount the Player should at least havepublic java.lang.String getPriceTag(org.bukkit.entity.Player p,
double cost)
p - The Player whose Balance you want to checkcost - The Amount the Player should at least havepublic static Currency getByName(java.lang.String name)
name - The Name of the Currency you are looking forpublic static java.util.Collection<Currency> list()