Skip to content

ByteForge88/MoneyAPI

Repository files navigation

Description

MoneyAPI is an econimic plugin that introduces virtural currency to use within your server. This plugin also provides developers with a easy to read/use API so you don't have to rewrite an entire economy system.

Unlike other economy plugins out there, this plugin is very light no heavy calls just straight method calls.

MoneyAPI uses SQLite3 to store all balances to keep them secure and prevent any loss from server restarts.

Features

  • Easy to use API
  • All command based (with custom permissions)
  • Uses SQLite3 database as storage
  • Very customizable e.g. messages, currency symbol and starting balance
  • Player's can view their or someone else's balance
  • Player's can view the top 10 balances
  • Operators can remove/set/add money (Use a ranks system to use the custom permissions)
  • ScoreHud support

Assets

ScoreHud is supported so download MoneyAPIScoreTag and make sure ScoreHud AND MoneyAPI are installed.

ScoreTag: {moneyapi.balance}

TODO

  • Scoreboard support (ScoreHud)
  • Implement floating text leaderboards
  • Add taxes?

API

How to import the main class instance:

use byteforge88\moneyapi\MoneyAPI;

How to get the main instance:

use byteforge88\moneyapi\MoneyAPI;

$money = MoneyAPI::getInstance();

How to get the balance of a player:

use pocketmine\player\Player;

use byteforge88\moneyapi\MoneyAPI;

//You can either use the Player::class or player name
//$player is instanceof Player::class

MoneyAPI::getInstance()->getBalance($player);

MoneyAPI::getInstance()->getBalance("ByteForge88");

How to add money to a player's balance:

use pocketmine\player\Player;

use byteforge88\moneyapi\MoneyAPI;

//You can either use the Player::class or player name
//$player is instanceof Player::class

MoneyAPI::getInstance()->addMoney($player);

MoneyAPI::getInstance()->addMoney("ByteForge88");

How to remove money to a player's balance:

use pocketmine\player\Player;

use byteforge88\moneyapi\MoneyAPI;

//You can either use the Player::class or player name
//$player is instanceof Player::class

MoneyAPI::getInstance()->removeMoney($player);

MoneyAPI::getInstance()->removeMoney("ByteForge88");

How to set a player's balance:

use pocketmine\player\Player;

use byteforge88\moneyapi\MoneyAPI;

//You can either use the Player::class or player name
//$player is instanceof Player::class

MoneyAPI::getInstance()->setBalance($player);

MoneyAPI::getInstance()->setBalance("ByteForge88");

How to check to see if a player exists before retrieving their balance:

use pocketmine\player\Player;

use byteforge88\moneyapi\MoneyAPI;

//You can either use the Player::class or player name
//$player is instanceof Player::class

if (MoneyAPI::getInstance()->isNew($player)) {
    //if the player doesn't exixts then this will execute...
    return;
}

if (MoneyAPI::getInstance()->isNew("ByteForge88")) {
    //if the player doesn't exixts then this will execute...
    return;
}

How to format the amount:

MoneyAPI::getInstance()->formatMoney(1000);

output:
$1,000

//this will use the currency symbol thats set in the config
//this will also convert integers into a string

About

Simple economy system for PocketMine-MP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages