Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MassiveEconomy v1.0 R3

Advanced Economy Plugin + API

For Users:

Configuration (config.yml):


---
#Money Symbol
money-symbol: "$"
#Default money when a player joins for first time (he must have the permission: massiveeconomy.receivedefault)
default-money: 500
#Minimum money that the player can have (you can use also negative numbers)
min-money: 0
...

Commands:

/massiveeconomy - MassiveEconomy commands (aliases: [meco, massiveeco, me])
/money <player (optional)> - Show your money (or player's money)
/pay <player> <amount> - Pay a player

/setmoney <player> <amount> - Set player money


Permissions:

- massiveeconomy.*
- MassiveEconomy permissions.
- massiveeconomy.receivedefault - Receive default money permission.
- massiveeconomy.commands.help - MassiveEconomy command Help permission.
- massiveeconomy.commands.info - MassiveEconomy command Info permission.
- massiveeconomy.commands.reload - MassiveEconomy command Reload permission.
- massiveeconomy.commands.setmoney - MassiveEconomy command SetMoney permission.
- massiveeconomy.commands.pay - MassiveEconomy command Pay permission.
- massiveeconomy.commands.money - MassiveEconomy command Money permission.
- massiveeconomy.commands.money.others - Show other players' money permission.

For Developers:

Basic Tutorial:

1. Define the plugin dependency in plugin.yml:
Code:
depend: [MassiveEconomy]
2. Include MassiveEconomy API in your php code:
PHP:
use MassiveEconomy\MassiveEconomyAPI;
3. Check if MassiveEconomy API is compatible (insert this code in onEnable() function)
PHP:
if(MassiveEconomyAPI::getInstance()->getAPIVersion() == "(used API version)"){
            
//API compatible
        
}else{
            
//API not compatible
            
$this->getPluginLoader()->disablePlugin($this);
        }
4. Call the API function:
PHP:
MassiveEconomyAPI::getInstance()->(API function);
A full plugin example using MassiveEconomy API is included in the ZIP file.

API Functions:

Get Money Symbol:
PHP:
string getMoneySymbol()
Description:
Get money symbol (defined in config).
Return:
money symbol

Get Default Money:
PHP:
int getDefaultMoney()
Description:
Get default money (defined in config).
Return:
default money

Get Minimum Money:
PHP:
int getMinimumMoney()
Description:
Get minimum money (defined in config).
Return:
minimum money

Get Version:
PHP:
string getVersion()
Description:
Get the MassiveEconomy plugin version.
Return:
plugin version

Get API Version:
PHP:
string getAPIVersion()
Description:
Get the MassiveEconomy API version.
Return:
plugin API version

Register Player:
PHP:
void RegisterPlayer(Player $player)
Description:
Register a player to MassiveEconomy.
Parameters:
$player must be the Player (pocketmine/player)

Check if a Player is registered:
PHP:
boolean isPlayerRegistered($player)
Description:
Check if a player is registered to MassiveEconomy.
Parameters:
$player must be the player name
Return:
true if the player is registered
false if the player isn't registered

Get Money:
PHP:
int|boolean getMoney($player)
Description:
Get player money.
Parameters:
$player must be the player name
Return:
player money if the player is registered
false if the player isn't registered

Set Money:
PHP:
boolean setMoney($player$amount)
Description:
Set player money.
Parameters:
$player must be the player name
$amount the amount (must be a number)
Return:
true if the player is registered
false if the player isn't registered

Pay Player:
PHP:
boolean payPlayer($receiver$amount)
Description:
Pay a player.
Parameters:
$receiver must be the player name
$amount the amount (must be a number)
Return:
true if the player is registered
false if the player isn't registered

Pay Player from Player:
PHP:
int payMoneyToPlayer($sender$amount$receiver)
Description:
Pay money to player from another player.
Parameters:
$sender must be the player name
$amount the amount (must be a number)
$receiver must be the player name
Return:
3 success
2 if the sender hasn't enough money
1 if the receiver isn't registered
0 if the sender isn't registered

Take Money:
PHP:
int takeMoney($player$amount)
Description:
Take Money from Player.
Parameters:
$player must be the player name
$amount the amount (must be a number)
Return:
2 success
1 if the player hasn't enough money
0 if the player isn't registered
Advertisement