Skip to content

amirxdcy4455/TradeSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿฆ TradeSystem for PocketMine-MP 5

โœจ Features

  • 20+ cryptocurrencies with realistic price simulation
  • Physical wallet item system
  • Real-time price updates with momentum algorithm
  • EconomyAPI integration
  • Beautiful UI forms
  • Optimized performance

๐Ÿ“ฆ Installation

  1. Download the latest .phar from Releases
  2. Place in plugins/ folder
  3. Restart server
  4. Configure in currency.yml
  5. Use /trade or /wallet

๐ŸŽฎ Commands

Command Description Permission
/trade Open trading interface trade.use.cmd
/wallet Get/access digital wallet trade.use.cmd

! Info

author Version api
Amirxd 1.0.0 5.0.0

โš™๏ธ Configuration

settings.yml

update_interval: 30
default_volatility: 3.0
save_interval_runs: 4
max_price_change_percent: 5.0

currency.yml

bitcoin:
  min: 100000
  max: 1000000
  start_price: 160000
  volatility: 3.5
  image: "none"

๐Ÿ“Š API Documentation

Basic Access

$tradeSystem = TradeSystem::getTradeSystem();
$wallet = $tradeSystem->getWalletManager();
$currency = $tradeSystem->getCurrency();

Wallet Operations

// Check wallet exists
if($wallet->walletExists($playerName)) {
    // Get balance
    $balance = $wallet->getCurrency($playerName, "bitcoin");
    
    // Add currency
    $wallet->addCurrency($playerName, "ethereum", 5.5);
    
    // Remove currency
    $wallet->TakeCurrency($playerName, "solana", 2.0);
}

Currency Operations

// Get currency info
$info = $currency->getCurrency("bitcoin");
$currentPrice = $info["price"];

// Update prices
$currency->updateAllPrices(5.0, true);

// Manually set price
$currency->setNewPrice("bitcoin", 200000);

Form Integration

// Open trading interface
(new MainForm())->MainForm($player);

// Open wallet
(new MainForm())->WalletForm($player);

Transaction Processing

// Programmatic buy/sell
$success = $mainForm->processTransaction($player, "bitcoin", 2.5, "buy");

๐Ÿ”ง Event System

Wallet items can be detected via:

if($item->getNamedTag()->getTag("wallet") !== null) {
    // This is a wallet item
}

๐Ÿš€ Advanced Usage

Custom Currency Registration

$currency->Currency["customcoin"] = [
    "price" => 10000,
    "old" => 10000,
    "min" => 0,
    "max" => 50000
];

Portfolio Calculation

// Calculate total portfolio value
$walletData = $wallet->getWalletData($playerName);
$totalValue = 0;

foreach($walletData as $currency => $amount) {
    if($currency === "money") {
        $totalValue += $amount;
    } else {
        $price = $currency->getCurrency($currency)["price"] ?? 0;
        $totalValue += ($amount * $price);
    }
}

๐Ÿ“ˆ Price Algorithm

Prices update using:

  1. Random fluctuation based on volatility
  2. Momentum from previous changes
  3. Min/max boundaries
  4. Configurable update intervals

๐Ÿ” Troubleshooting

  • Prices not updating? Check update_interval
  • Wallet issues? Verify EconomyAPI is installed
  • Forms not showing? FormAPI required

๐Ÿ“„ License

MIT License


For complete code examples and advanced usage, refer to the source code.

About

A PocketMine-MP cryptocurrency trading plugin with real-time markets, digital wallets, and dynamic pricing simulation.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages