{"id":15143526,"url":"https://github.com/cooldogepm/bedrockeconomy","last_synced_at":"2025-10-23T20:30:41.344Z","repository":{"id":40452834,"uuid":"400814840","full_name":"cooldogepm/BedrockEconomy","owner":"cooldogepm","description":"An extremely customizable Economy plugin designed for scalability and simplicity","archived":false,"fork":false,"pushed_at":"2024-04-20T17:08:51.000Z","size":579,"stargazers_count":48,"open_issues_count":5,"forks_count":17,"subscribers_count":2,"default_branch":"pm5","last_synced_at":"2025-01-30T20:51:51.848Z","etag":null,"topics":["api","economy","mcbe","minecraft","mysql","php","pmmp","pocketmine","sql","sqlite"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cooldogepm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-08-28T14:38:04.000Z","updated_at":"2024-12-27T18:49:06.000Z","dependencies_parsed_at":"2024-03-23T03:31:35.383Z","dependency_job_id":"cd852a29-5c52-4071-bc5d-1cf3ddab6381","html_url":"https://github.com/cooldogepm/BedrockEconomy","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cooldogepm%2FBedrockEconomy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cooldogepm%2FBedrockEconomy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cooldogepm%2FBedrockEconomy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cooldogepm%2FBedrockEconomy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cooldogepm","download_url":"https://codeload.github.com/cooldogepm/BedrockEconomy/tar.gz/refs/heads/pm5","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237882172,"owners_count":19381176,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","economy","mcbe","minecraft","mysql","php","pmmp","pocketmine","sql","sqlite"],"created_at":"2024-09-26T10:01:50.639Z","updated_at":"2025-10-23T20:30:35.942Z","avatar_url":"https://github.com/cooldogepm.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BedrockEconomy\nBedrockEconomy is an economy plugin made for PocketMine-MP focused on stability and simplicity.\n\u003cbr\u003e\n## Table of Contents\n\n- [Commands](#commands)\n- [Features](#features)\n- [Examples](#examples)\n  - [Retrieving a Player's Balance](#retrieving-a-players-balance)\n  - [Retrieving Multiple Player Balances](#retrieving-multiple-player-balances)\n  - [Adding Funds to a Player's Balance](#adding-funds-to-a-players-balance)\n  - [Subtracting Funds from a Player's Balance](#subtracting-funds-from-a-players-balance)\n  - [Transferring Funds Between Players](#transferring-funds-between-players)\n- [Tools](#tools)\n- [License](#license)\n\n## Commands\n| Name          | Description | Usage                                             | Permission                             |\n|---------------| ----------- |---------------------------------------------------|----------------------------------------|\n| balance       | Show your and others balance | `balance [player: string]`                        | `bedrockeconomy.command.balance`       |\n| pay           | Pay others with your balance | `pay \u003cplayer: string\u003e \u003camount: number\u003e`           | `bedrockeconomy.command.pay`           |\n| rich          | View the top balances | `rich [page: number]`                             | `bedrockeconomy.command.rich`          |\n| addbalance    | Add points to others balance | `addbalance \u003cplayer: string\u003e \u003camount: number\u003e`    | `bedrockeconomy.command.addbalance`    |\n| removebalance | Remove points from others balance | `removebalance \u003cplayer: string\u003e \u003camount: number\u003e` | `bedrockeconomy.command.removebalance` |\n| setbalance    | Set others balance | `setbalance \u003cplayer: string\u003e \u003cbalance: number\u003e`   | `bedrockeconomy.command.setbalance`    |\n\n## Features\n- [x] MySQL Database\n- [x] SQLite Database\n- [x] Async API\n- [x] Closure API\n- [x] Customizable\n- [x] Easy to use\n- [x] Lightweight\n- [x] Fast and efficient\n- [x] Cache system\n\n## Examples\n\n### Retrieving a Player's Balance\n\nYou can retrieve a player's balance using the `get` method. Here's an example:\n\n```php\nBedrockEconomyAPI::CLOSURE()-\u003eget(\n    xuid: \"123456789\",\n    username: \"Doge\",\n    onSuccess: static function (array $result): void {\n        echo \"Balance: \" . $result[\"amount\"] . \" Decimals: \" . $result[\"decimals\"] . \" Position: \" . $result[\"position\"];\n    },\n    onError: static function (SQLException $exception): void {\n        if ($exception instanceof RecordNotFoundException) {\n            echo \"Record not found\";\n            return;\n        }\n\n        echo $exception-\u003egetMessage();\n    }\n);\n\n// Using async-await\nAwait::f2c(\n    function (): Generator {\n        try {\n            $result = yield from BedrockEconomyAPI::ASYNC()-\u003eget(\n                xuid: \"123456789\",\n                username: \"Doge\",\n            );\n        } catch (RecordNotFoundException) {\n            echo \"Account not found\";\n            return;\n        } catch (SQLException) {\n            echo \"Database error\";\n            return;\n        }\n        \n        echo \"Balance: \" . $result[\"amount\"] . \" Decimals: \" . $result[\"decimals\"] . \" Position: \" . $result[\"position\"];\n    }\n);\n```\n\n### Retrieving Multiple Player Balances\n\nYou can retrieve multiple player balances using the `bulk` method. Here's an example:\n\n```php\nBedrockEconomyAPI::CLOSURE()-\u003ebulk(\n    list: [\"Doge\", \"123456789\"], // You can use both username and xuid\n    onSuccess: static function (array $result): void {\n        foreach ($result as $data) {\n            echo \"Player: \" . $data[\"username\"] . \" Balance: \" . $data[\"amount\"] . \" Decimals: \" . $data[\"decimals\"] . \" Position: \" . $data[\"position\"];\n        }\n    },\n    onError: static function (SQLException $exception): void {\n        if ($exception instanceof RecordNotFoundException) {\n            echo \"No records found\";\n            return;\n        }\n\n        echo $exception-\u003egetMessage();\n    }\n);\n\n// Using async-await\nAwait::f2c(\n    function (): Generator {\n        try {\n            $result = yield from BedrockEconomyAPI::ASYNC()-\u003ebulk(\n                list: [\"Doge\", \"123456789\"], // You can use both username and xuid\n            );\n        } catch (RecordNotFoundException) {\n            echo \"No records found\";\n            return;\n        } catch (SQLException) {\n            echo \"Database error\";\n            return;\n        }\n        \n        foreach ($result as $data) {\n            echo \"Player: \" . $data[\"username\"] . \" Balance: \" . $data[\"amount\"] . \" Decimals: \" . $data[\"decimals\"] . \" Position: \" . $data[\"position\"];\n        }\n    }\n);\n```\n\n### Adding Funds to a Player's Balance\n\nYou can add funds to a player's balance using the `add` method. Here's an example:\n\n```php\nBedrockEconomyAPI::CLOSURE()-\u003eadd(\n    xuid: \"123456789\",\n    username: \"Doge\",\n    amount: 55,\n    decimals: 25,\n    onSuccess: static function (): void {\n        echo 'Balance updated successfully.';\n    },\n    onError: static function (SQLException $exception): void {\n        if ($exception instanceof RecordNotFoundException) {\n            echo 'Account not found';\n            return;\n        }\n\n        echo 'An error occurred while updating the balance.';\n    }\n);\n\n// Using async-await\nAwait::f2c(\n    function () use ($player): Generator {\n        try {\n            yield from BedrockEconomyAPI::ASYNC()-\u003eadd(\n                xuid: \"123456789\",\n                username: \"Doge\",\n                amount: 55,\n                decimals: 25,\n            );\n            echo 'Balance updated successfully.';\n        } catch (RecordNotFoundException) {\n            echo 'Account not found';\n        } catch (SQLException) {\n            echo 'An error occurred while updating the balance.';\n        }\n    }\n);\n```\n\n### Subtracting Funds from a Player's Balance\n\nYou can subtract funds from a player's balance using the `subtract` method. Here's an example:\n\n```php\nBedrockEconomyAPI::CLOSURE()-\u003esubtract(\n    xuid: \"123456789\",\n    username: \"Doge\",\n    amount: 55,\n    decimals: 25,\n    onSuccess: static function (): void {\n        echo 'Balance updated successfully.';\n    },\n    onError: static function (SQLException $exception): void {\n        if ($exception instanceof RecordNotFoundException) {\n            echo 'Account not found';\n            return;\n        }\n\n        if ($exception instanceof InsufficientFundsException) {\n            echo 'Insufficient funds';\n            return;\n        }\n\n        echo 'An error occurred while updating the balance.';\n    }\n);\n\n// Using async-await\nAwait::f2c(\n    function () use ($player): Generator {\n        try {\n            yield from BedrockEconomyAPI::ASYNC()-\u003esubtract(\n                xuid: \"123456789\",\n                username: \"Doge\",\n                amount: 55,\n                decimals: 25,\n            );\n            echo 'Balance updated successfully.';\n        } catch (RecordNotFoundException) {\n            echo 'Account not found';\n        } catch (InsufficientFundsException) {\n            echo 'Insufficient funds';\n        } catch (SQLException) {\n            echo 'An error occurred while updating the balance.';\n        }\n    }\n);\n```\n\n### Transferring Funds Between Players\n\nYou can transfer funds from one player to another using the `transfer` method. Here's an example:\n\n```php\n$sourcePlayer = ['xuid' =\u003e 'source_xuid', 'username' =\u003e 'source_username'];\n$targetPlayer = ['xuid' =\u003e 'target_xuid', 'username' =\u003e 'target_username'];\n\nBedrockEconomyAPI::CLOSURE()-\u003etransfer(\n    source: $sourcePlayer,\n    target: $targetPlayer,\n    amount: 55,\n    decimals: 25,\n    onSuccess: static function (): void {\n        echo 'Balance transfer successful.';\n    },\n    onError: static function (SQLException $exception): void {\n        if ($exception instanceof RecordNotFoundException) {\n            echo 'Account not found';\n            return;\n        }\n        \n        if ($exception instanceof InsufficientFundsException) {\n            echo 'Insufficient funds';\n            return;\n        }\n\n        echo 'An error occurred during the balance transfer.';\n    }\n);\n\n// Using async-await\nAwait::f2c(\n    function () use ($sourcePlayer, $targetPlayer): Generator {\n        try {\n            yield from BedrockEconomyAPI::ASYNC()-\u003etransfer(\n                source: $sourcePlayer,\n                target: $targetPlayer,\n                amount: 55,\n                decimals: 25,\n            );\n            echo 'Balance transfer successful.';\n        } catch (RecordNotFoundException) {\n            echo 'Account not found';\n        } catch (InsufficientFundsException) {\n            echo 'Insufficient funds';\n        } catch (SQLException) {\n            echo 'An error occurred during the balance transfer.';\n        }\n    }\n);\n```\n\nThese examples demonstrate how to perform common operations using the BedrockEconomy API, such as retrieving player balances, adding and subtracting funds, and transferring funds between players.\n\n## Tools\n\n* [BedrockEconomyHistory](https://github.com/cooldogepm/BedrockEconomyHistory)\n* [BedrockEconomyScore](https://github.com/cooldogepm/BedrockEconomyScore)\n\n## License\n\nThis project is released under the MIT License. For more information, please refer to the [LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcooldogepm%2Fbedrockeconomy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcooldogepm%2Fbedrockeconomy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcooldogepm%2Fbedrockeconomy/lists"}