Code Monkey home page Code Monkey logo

bankui's Introduction

Information

  • This plugin allows players to store their money in a bank.

Features

  • Withdraw Money into Bank
  • Deposit Money from Bank
  • Transfer Money to Other Players Bank Accounts
  • Transaction Log
  • Daily Interest
  • Configurable Interest Rates
  • Admins Can Manage Other Players Bank With "/bank {PlayerName}"
  • Customizable Messages
  • Automatic Backup System
  • Database Migration
  • MySQL and SQLite Support
  • Developer API
  • Bedrock Economy Support
  • ScoreHud Support

Command

Player Commands

  • /bank

Admin Commands

  • /bank {PlayerName}
  • /bank migrate - DO NOT USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING!
  • /bank backup {save | load | restore} - Becareful when loading a backup, you will lose all data since the last saved backup unless you restore it but DO NOT take the risk!

Important

  • This plugin requires the latest version of Bedrock Economy!

ScoreHud Support

  • ScoreHud Tag: {bankui.money}

Images

Bank5 Bank2 Bank3 Bank4 Bank6 Admin

Permissions

  • bankui.cmd
  • bankui.admin
  • bankui.admin.backup (Required to use /bank backup)
  • bankui.admin.migrate (Required to use /bank migrate)

Developer API

  • You can give/take/set/get/save players money/transactions using our API.

BankUI::getInstance()->handleAction($player, $action, $subaction, $amount);

  • Add Money: BankUI::getInstance()->addMoney($playerName, $amount);
  • Take Money: BankUI::getInstance()->takeMoney($playerName, $amount);
  • Set Money: BankUI::getInstance()->setMoney($playerName, $amount);
  • Get Money: BankUI::getInstance()->>getMoney($playerName)->onCompletion(function(float $amount): void{ // Use $amount to get player's balance }, static fn() => null);
  • Add Economy Money: $this->addEconomyMoney($player->getName(),$data[1])->onCompletion(function (bool $updated): void{ if ($updated) { // Addition was successful } else { // Addition was not successful } }, static fn() => null);
  • Take Economy Money: $this->takeEconomyMoney($player->getName(),$data[1])->onCompletion(function (bool $updated): void{ if ($updated) { // Deduction was successful } else { // Deduction was not successful } }, static fn() => null);
  • Get Economy Money: $this->getEconomyMoney($player->getName())->onCompletion(function (float $money): void{ use $money to get the player's money }, static fn() => null);
  • Add Transaction: BankUI::getInstance()->addTransaction($playerName, $transaction);
  • Get Transactions: BankUI::getInstance()->>getTransactions($playerName)->onCompletion(function(string $transactions): void{ // Code (use $transactions) }, static fn() => null);
  • Check If Account Exists: BankUI::getInstance()->>accountExists($playerName)->onCompletion(function(bool $exists): void{ // Use $exists to check if account exists }, static fn() => null);
  • Set Transactions: BackupSystem::getInstance()->setTransaction($playerName, $transactions);
  • Save Data: BackupSystem::getInstance()->saveData($player);
  • Save All Online Players Data: BackupSystem::getInstance()->saveAllData();
  • Backup Data - REQUIRES BACKUP ENABLED: BackupSystem::getInstance()->backupData();
  • Load Backup - REQUIRES BACKUP ENABLED: BackupSystem::getInstance()->loadBackup();
  • Restore Backup - REQUIRES BACKUP ENABLED: BackupSystem::getInstance()->restoreBackup();
  • Migrate Database (Only "SQLite", "MySQL", and "SQL" is supported. "SQL" will migrate the database from/to the current database type in use and you should Save All before using this. Make sure you know what your doing as you can lose all of your data if not used correctly.): DatabaseMigration::getInstance()->migrateDatabase($migrateFrom, $migrateTo);

Config

# If true, players will get daily interest for the money in their bank
enable-interest: true

# Interst Rates is in percentage so if interst-rates = 50, it means 50% Interest Rates, if it is set at 1, it means 1% interest rates. (It is recommended to keep this low)
interest-rates: 1

# Backup System - You may want to set this to false if you think you or your staff may accidentally restore a backup and lose your data
enable-backups: true 

# "enabled-backups" must be true for automatic backups. 
enable-automatic-backups: true

# "enable-automatic-backups" must be true for this. This is how often your databases get automatically backed up. This is in minutes so 60 = 60 minutes. This number should be between 720-1440 (12-24 hours) DO NOT go less
# than 60 (1 hour) as this could cause lag for a few seconds if you have had alot of unique players join yuour server.
automatic-backups-time: 720

database:
  # The database type. "sqlite" and "mysql" are supported.
  type: sqlite

  # Edit these settings only if you choose "sqlite".
  sqlite:
    # The file name of the database in the plugin data folder.
    # You can also put an absolute path here.
    file: players.sqlite
  # Edit these settings only if you choose "mysql".
  mysql:
    host: 127.0.0.1
    # Avoid using the "root" user for security reasons.
    username: root
    password: ""
    schema: your_schema
  # The maximum number of simultaneous SQL queries
  # Recommended: 1 for sqlite, 2 for MySQL. You may want to further increase this value if your MySQL connection is very slow.
  worker-limit: 1
  
# "enable-backups" must be enabled for backups to work.
backup-database:
  # The database type. "sqlite" and "mysql" are supported. This should be set to "mysql" for backups to be most useful although you can use "sqlite" if you do not have a MySQL database.
  type: sqlite

  # Edit these settings only if you choose "sqlite".
  sqlite:
    # The file name of the database in the plugin data folder.
    # You can also put an absolute path here.
    file: backup.sqlite
  # Edit these settings only if you choose "mysql".
  mysql:
    host: 127.0.0.1
    # Avoid using the "root" user for security reasons.
    username: root
    password: ""
    schema: your_schema
  # The maximum number of simultaneous SQL queries
  # Recommended: 1 for sqlite, 2 for MySQL. You may want to further increase this value if your MySQL connection is very slow.
  worker-limit: 1
  
# DO NOT TOUCH
config-ver: 2

Credits

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.