Skip to content
On this page

💰 Economic System API

In many servers, the economic system is a very critical part.
In order to solve various problems of traditional use of the scoreboard economic system, LegacyScriptEngine provides an interface to connect to the LegacyMoney economic system, whose data is shared with other mods and plugins.

In addition to the capabilities of the traditional economic system, LegacyMoney also has additional capabilities such as querying the history of changes in the amount and operating the economy of offline players.
LegacyMoney is a dependency of LegacyScriptEngine (it is not bundled with LeviLamina) and is installed together with LegacyScriptEngine, so you can use this interface directly without additional installation.

Set the Player’s Deposit Amount

Player.setMoney(value)

money.set(xuid,value)

  • Parameters:
  • xuid : String
    The XUID identifier of the player.
  • value : Integer
    Amount of money being set.
  • Return value: Whether the setting is successful.
  • Return value type: Boolean

Get the Player’s Deposit Amount

Player.getMoney()

money.get(xuid)

  • Parameter:
  • xuid : String
    The XUID identifier of the player to read.
  • Return value: Player's bank value.
  • Return value type: Integer

Increase Player’s Deposit

Player.addMoney(value)

money.add(xuid,value)

  • Parameters:
  • xuid : String
    The XUID identifier of the player.
  • value : Integer
    The amount of money to add to the player's bank.
  • Return value: Whether the setting is successful.
  • Return value type: Boolean

Decrease the Player’s Deposit

Player.reduceMoney(value)

money.reduce(xuid,value)

  • Parameters:
  • xuid : String
    The XUID identifier of the player.
  • value : Integer
    The amount of money to take from the player.
  • Return value: Whether the setting is successful.
  • Return value type: Boolean

Make a Transfer

Player.transMoney(target,money[,note])

money.trans(xuid1,xuid2,money[,note])

  • Parameters:

  • xuid1 : String
    The XUID identifier of the paying player.

  • xuid2 : String
    The XUID identifier of the player who will receive the payment.

    If you are using Player.transMoney, target can be Player.

  • money : Integer
    The amount of money being transferred.

  • note : String
    (Optional) Add some text to this transfer.

  • Return value: Whether the transfer is successful.

  • Return value type: Boolean

Query Historical Payments

Player.getMoneyHistory(time)

money.getHistory(xuid,time)

  • Parameters:
  • xuid : String
    The XUID identifier of the player.
  • time : Integer
    Query all records within the last time seconds.
  • Return value: An array of query result objects.
  • Return value type: Array<Object>

Where the result is an array of record objects. for each record object record, with the following keys and corresponding values:

KeyMeaning of ValueData Type
record.fromXUID of money senderString
record.toXUID of money receiverString
record.moneyAmount of moneyInteger
record.timeTime when this transaction occurredString
record.noteAdditional notes for this transaction.String

The format of the time string is: YYYY-mm-dd hh:mm:ss

Delete Billing History

money.clearHistory(time)

  • Parameter:
  • time : Integer
    Delete all records within the last time seconds.
  • Return value: Whether the deletion is successful.
  • Return value type: Boolean