Giter VIP home page Giter VIP logo

multieconomy's Introduction

MultiEconomy

MultiEconomy is an Economy system with multiple currencies!

Installation

  • You can get the compiled .phar in releases by clicking here
  • Add the .phar to your /plugins directory & restart your server.

Note: This plugin has been tested on PocketMine-MP 3.2.0. Additional support for forks will not happen

Commands

MultiEconomy is still a work-in-progress but it has a few commands!

Command Aliases Description Permission
/addtobalance <player> <currency> <amount> /addtobal Add to a players balance multieconomy.addtobalance
/balance [player/currency] [currency] /bal Check yours or another players balance None
/balancetop [currency] [page] /baltop Show the top balances for a currency None
/pay <player> <currency> <amount> None Pay another player money for a currency None
/removefrombalance <player> <currency> <amount> /remfrombal Remove from a players balance multieconomy.removefrombalance
/setbalance <player> <currency> <balance> /setbal Set a player's balance for a currency multieconomy.setbalance

Languages

MultiEconomy has a language system, the list below are implemented languages and their 3 digit code

  • English: eng

Create a Pull Request with the language name, and a proper translation of eng.yml to request another language

API

MultiEconomy has a built in API, so you can interrogate MultiEconomy with your own plugins To get the API class, you have to use PluginManager::getPlugin() to get an instance of MultiEconomy's main class.

/** @var PluginBase $this */
$plugin = $this->getServer()->getPluginManager()->getPlugin("MultiEconomy");

Now you have an instance of the main class, you can use the getAPI() function

$api = $plugin->getAPI();

To create a new currency in order to register it, you can do the following:

$name = "Dollars"; // Currency name
$symbol = "$"; // Symbol for currency amounts 
$symbolAfter = false; // Wether the symbol comes before or after the amount
$startingAmount = 0; // The amount a player starts on when they first get a balance
$minAmount = 0; // Minimum amount a player can have in the currency
$maxAmount = 999999; // Maximum amount a player can have in the currency
$currency = new Twisted\MultiEconomy\Currency($name, $symbol, $symbolAfter, $startingAmount, $minAmount, $maxAmount);

Functions

Function Parameters Return Type Description
registerCurrency Twisted\MultiEconomy\Currency $currency \Boolean Register a currency to the plugin, returns true/false on success/failure
getLangData \string $language pocketmine\config\Config Get config file for a certain language
getMessage \string $key, \array $values Get a translated message to servers language \string
getCurrencies None Twisted\MultiEconomy\Currency[] Get all the registered currencies
getCurrencyNames None \string[] Get all the registered currencies' names
checkBalance \string $player, \string $currency \void Sets a players balance to the starting amount for given currency if they don't have a balance
addToBalance \string $player, \string $currency, \int $amount \void Adds to a players balance for a currency
getBalance \string $player, \string $currency \null \int Returns the players balance for a currency, null if they don't have a balance
getBalances \string $currency pocketmine\config\Config Returns a config with all balances for the currency
setBalance \string $player, \string $currency, \int $amount \void Set a players balance for a currency
takeFromBalance \string $player, \string $currency, \string $amount \void Takes from a players balance for a currency

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.