public class CEconomy extends Observable
Economy
objectModifier and Type | Field and Description |
---|---|
protected Lang |
format
The
LangFile format to use for output |
Constructor and Description |
---|
CEconomy(Plugin plugin)
Sets the format string for this object to use for output
|
Modifier and Type | Method and Description |
---|---|
void |
addObserver(EconomyObserver o)
Adds an
EconomyObserver to this CEconomy |
void |
addObserver(Observer o) |
double |
bonusRate()
Represents a rate that is multiplied to money given through the
pay(OfflinePlayer, double) method. |
ChargeStatus |
canCharge(OfflinePlayer p,
com.codelanx.commons.config.ConfigFile value)
Returns whether or not a specific
OfflinePlayer can be charged an
amount |
ChargeStatus |
canCharge(OfflinePlayer p,
double cost)
Returns whether or not a specific
OfflinePlayer can be charged an
amount |
boolean |
charge(OfflinePlayer p,
com.codelanx.commons.config.ConfigFile value)
Takes money away from the
OfflinePlayer |
boolean |
charge(OfflinePlayer p,
double cost)
Takes money away from the
OfflinePlayer |
double |
getBalance(OfflinePlayer p)
Returns the relevant balance for the
OfflinePlayer |
protected net.milkbowl.vault.economy.Economy |
getEconomy()
Returns the underlying
Economy object that is backed by a
VaultProxy InvocationHandler |
boolean |
isEnabled()
Returns whether or not the
Economy object could be retrieved from
Vault |
void |
notifyObservers(Object arg)
Modified to send a Bukkit event and force notification of the change
|
boolean |
pay(OfflinePlayer p,
com.codelanx.commons.config.ConfigFile value)
Gives money to the
OfflinePlayer |
boolean |
pay(OfflinePlayer p,
double amount)
Gives money to the
OfflinePlayer |
protected void |
setChanged()
|
double |
taxRate()
Represents a rate that is multiplied to money taken through the
charge(OfflinePlayer, double) method. |
clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers
protected final Lang format
LangFile
format to use for outputpublic ChargeStatus canCharge(OfflinePlayer p, com.codelanx.commons.config.ConfigFile value)
OfflinePlayer
can be charged an
amountp
- The OfflinePlayer
to check if they can be chargedvalue
- A ConfigFile
double value representing how much to takeChargeStatus
representing the total cost and the status
of whether or not the OfflinePlayer
can be charged. If
isEnabled()
returns false
, this will be
a ChargeStatus
of true
with a returned cost of 0public ChargeStatus canCharge(OfflinePlayer p, double cost)
OfflinePlayer
can be charged an
amountp
- The OfflinePlayer
to check if they can be chargedcost
- The amount to chargeChargeStatus
representing the total cost and the status
of whether or not the OfflinePlayer
can be charged. If
isEnabled()
returns false
, this will be
a ChargeStatus
of true
with a returned cost of 0public boolean charge(OfflinePlayer p, com.codelanx.commons.config.ConfigFile value)
OfflinePlayer
p
- The OfflinePlayer
to take money fromvalue
- A ConfigFile
double value representing how much to taketrue
if the money was successfully taken, or if
isEnabled()
returns false
public boolean charge(OfflinePlayer p, double cost)
OfflinePlayer
p
- The OfflinePlayer
to take money fromcost
- The amount of money to taketrue
if the money was successfully taken, or if
isEnabled()
returns false
public boolean pay(OfflinePlayer p, com.codelanx.commons.config.ConfigFile value)
OfflinePlayer
p
- The OfflinePlayer
to give money tovalue
- A ConfigFile
double value representing how much to givetrue
if the money was deposited successfully, or if
isEnabled()
returns false
public boolean pay(OfflinePlayer p, double amount)
OfflinePlayer
p
- The OfflinePlayer
to give money toamount
- The amount of money to givetrue
if the money was deposited successfully, or if
isEnabled()
returns false
public void notifyObservers(Object arg)
notifyObservers
in class Observable
arg
- An EconomyChangePacket
protected void setChanged()
setChanged
in class Observable
public double getBalance(OfflinePlayer p)
OfflinePlayer
p
- The OfflinePlayer
for which the balanced is checkedisEnabled()
returns false
public final boolean isEnabled()
Economy
object could be retrieved from
Vaultfalse
if the Economy
object is null
protected final net.milkbowl.vault.economy.Economy getEconomy()
Economy
object that is backed by a
VaultProxy
InvocationHandlerEconomy
objectpublic void addObserver(EconomyObserver o)
EconomyObserver
to this CEconomy
o
- The EconomyObserver
to be notified when the economy state changespublic void addObserver(Observer o)
addObserver
in class Observable
o
- public double taxRate()
charge(OfflinePlayer, double)
method. This method is
purposely overridable to allow for people to specify their own rates.
Values that are negative or zero will be automatically converted to 1.public double bonusRate()
pay(OfflinePlayer, double)
method. This method is
purposely overridable to allow for people to specify their own rates.
Values that are negative or zero will be automatically converted to 1.Copyright © 2017. All rights reserved.