BedrockEconomy is an economy plugin made for PocketMine-MP focused on stability and simplicity.
Name | Description | Usage | Permission |
---|---|---|---|
balance | Show your and others balance | balance [player: string] |
bedrockeconomy.command.balance |
pay | Pay others with your balance | pay <player: string> <amount: number> |
bedrockeconomy.command.pay |
topbalance | View the top balances | topbalance [page: number] |
bedrockeconomy.command.topbalance |
addbalance | Add points to others balance | addbalance <player: string> <amount: number> |
bedrockeconomy.command.addbalance |
removebalance | Remove points from others balance | removebalance <player: string> <amount: number> |
bedrockeconomy.command.removebalance |
setbalance | Set others balance | setbalance <player: string> <balance: number> |
bedrockeconomy.command.setbalance |
deleteaccount | Delete others account data | deleteaccount <player: string> |
bedrockeconomy.command.deleteaccount |
BedrockEconomyAPI::legacy()->getPlayerBalance(
"Steve",
ClosureContext::create(
function (?int $balance): void {
var_dump($balance);
},
)
);
BedrockEconomyAPI::legacy()->addToPlayerBalance(
"Steve",
1000,
ClosureContext::create(
function (bool $wasUpdated): void {
var_dump($wasUpdated);
},
)
);
BedrockEconomyAPI::legacy()->subtractFromPlayerBalance(
"Steve",
1000,
ClosureContext::create(
function (bool $wasUpdated): void {
var_dump($wasUpdated);
},
)
);
BedrockEconomyAPI::legacy()->setPlayerBalance(
"Steve",
1000,
ClosureContext::create(
function (bool $wasUpdated): void {
var_dump($wasUpdated);
},
)
);
BedrockEconomyAPI::legacy()->transferFromPlayerBalance(
"Steve", // Sender
"Alex", // Receiver
1000, // Amount
ClosureContext::create(
function (bool $successful): void {
var_dump($successful);
},
)
);
BedrockEconomyAPI::legacy()->isAccountExists(
"Steve",
ClosureContext::create(
function (bool $hasAccount): void {
var_dump($hasAccount);
},
)
);
BedrockEconomyAPI::legacy()->deletePlayerAccount(
"Steve",
ClosureContext::create(
function (bool $operationSuccessful): void {
var_dump($operationSuccessful);
},
)
);
BedrockEconomyAPI::legacy()->getHighestBalances(
limit: 10,
context: ClosureContext::create(
function (?array $accounts) use ($sender, $offset): void {
if (!$accounts) {
var_dump("The table is empty.");
return;
}
foreach ($accounts as $account) {
var_dump($account["username"] . ": " . $account["balance"]);
}
}
),
/**
* Offset is used to skip the first n * limited results.
* By default is set to 0 to retrieve the top n results starting from 0
*/
offset: 1,
);
/**
* The name of the addon, must be unique.
*
* @return string
*/
public function getName(): string
/**
* The version of the addon.
*
* @return string
*/
public function getVersion(): string
/**
* The minimum supported version of BedrockEconomy.
* If the version is @link Addon::SUPPORTED_BEDROCK_VERSION_ALL, the addon will be enabled on all BedrockEconomy versions.
*
* @return string
*/
public function getMinimumSupportedBedrockEconomyVersion(): string
/**
* Called before a plugin is enabled, this should be only used for dependency checking.
*
* @return void
*/
public function isLoadable(): void
/**
* Returns whether the addon is enabled or not.
*
* @return void
*/
public function isEnabled(): void
/**
* Called when the plugin is enabled. Similar to @link PluginBase::onEnable()
* Should be used for listeners registration and such logic.
*/
public function onEnable(): bool
/**
* Called when the addon is disabled. Similar to @link PluginBase::onDisable()
*/
public function onDisable(): bool
Name | Description |
---|---|
TransactionSubmitEvent | Called right before a transaction is submitted to the database |
TransactionProcessEvent | Called right after the transaction execution |
/**
* @param TransactionSubmitEvent $event
* @param TransferTransaction $transaction
*/
$transaction = $event->getTransaction();
if($transaction->getSender() === "Steve"){
$event->cancel();
}
/**
* @param TransactionProcessEvent $event
*/
if($event->isSuccessful()){
Server::getInstance()->broadcastMessage("A payment was successful!");
}
BedrockEconomy will automatically integrate with the Scorehud if it is installed.
{bedrockeconomy.balance}
{bedrockeconomy.balance_cap}
{bedrockeconomy.currency_symbol}
{bedrockeconomy.currency_name}