CurrencyAPI

by GameFriendsTeam

This plugin add new currences and api economy

version 1.6

9 downloads · 0 stars

Published 9 Jul 2026 from GameFriendsTeam/CurrencyAPI at a92cf6ef088789abcf7094f1117d522fcc051cdc, after moderator review.

Plugin description

CurrencyAPI | PocketMine-MP

Two-way economic A.P.I. to create currencies on the one hand, and on the other the usual economic plugin PocketMine-MP 5

For create currency

Main:

use gft\cur\API;

	/* ... */
		API::getCurrencyManager()->registerCurrency($main->getName(), new YourCurrency());
	/* ... */

Instead of YourCurrency the class of your currency Your Currency:

<?php
namespace your\plugin\space;

use gft\cur\currency\Currency;

class YourCurrency implements Currency {
	public function getPrice(): float {
		return 1;
	}
	public function getExchangeable(): string {
		return "Dollar";
	}
	public function onBuy(float $count): void { /* code */ }
	public function onSell(float $count): void { /* code */ }
	public function setPrice(float $price): void { /* code */ }
	public function getName(): string {
		return "Currency"; // currency name
	}
	public function getSing(): string {
		return "C"; // sing
	}
	public function isBuyable(): bool { return true; }
	public function isSalable(): bool { return true; }

	public function maxCount(): float { return PHP_float_MAX; }

	public function buyLimit(): float { return PHP_float_NAX; }
	public function sellLimit(): float { return PHP_float_MAX; }
}

For use economic side:

Add to balance:

$player->add($currencyName, $count);

For remove from balance:

$player->remove($currencyName, $count);

For set balance:

$player->set($currencyName, $count);

For complete transaction:

$player->transaction($currencyName, $count, $player);

For get balance

$count = $player->get($currencyName);

Commands

/[currency]

  • sell <count: float> all players
  • buy <count: float> all players
  • set <count: float> [player: string] operators only
  • add <count: float> [player: string] operators only
  • remove <count: float> [player: string] operators only
  • transaction <count: float> <player: string> all players

Installing it

Drop the phar into plugins/ and restart the server. If the API version below does not match your server, the plugin will refuse to load, which is the check working as intended.

Installing plugins

Releases

VersionAPIBuilt
1.65.36.09 Jul 2026 · 96 KB

SHA-256 of 1.66d16145970fc1871d2c3710fc0cd4b4d407ba95b491f56789f01e806b56dbcd0

Reviewed by a moderator before publishing. Built from GameFriendsTeam/CurrencyAPI at a92cf6ef088789abcf7094f1117d522fcc051cdc. Nobody reviews plugin code here: read the source before running it on a server you care about.

Comments

Sign in with GitHub to star this plugin or leave a comment.

No comments yet.