Welcome to the Hangar Open Beta. Please report any issue you encounter on GitHub!
Avatar for Jens98

API, CoinSystem, Coin, Coins, Money, Economy, Vault Economy, Vault

Report Coinsystem?

This plugin allows you to integrate an efficient currency system into your system.

Discord: https://discord.com/invite/FaHcQnunFp

To display coins in scoreboards etc use this placeholder with PlaceholderAPI:

%coinsystem_balance% -Alias for %coinsystem_coins%
%coinsystem_balance_formatted% - Shows your balance with thousands separator. Example: 1,234
%coinsystem_rank% - Shows your rank by coins. Example: 5
%coinsystem_top_balance% - Highest balance on the server. Example: 10000
%coinsystem_top_balance_formatted% - Formatted. Example: 10,000
%coinsystem_top_1_name% - Name of the richest player. Example: Pentrax
%coinsystem_server_balance_total% - Total coins on the server. Example: 123456
%coinsystem_server_balance_total_formatted% - Formatted. Example: 123,456
%coinsystem_default_balance% - Default starting balance for new players. Example: 1000
%coinsystem_default_balance_formatted% - Formatted. Example: 1,000
%coinsystem_next_rank_balance% - Coins needed for the next higher rank. Example: 2500
%coinsystem_next_rank_balance_formatted% - Formatted. Example: 2,500
%coinsystem_pay_limit% - Max coins you can pay at once (from config). Example: 5000
%coinsystem_pay_limit_formatted% - Formatted. Example: 5,000
%coinsystem_total_players% - Number of players with a coin account. Example: 42

Don't forget to depend my plugin in your plugin.yml, if you want to use my api.

name: YourPlugin
main: path
version: 1.0
description: Info
depend: [CoinSystem]


CoinApi.isCacheActive()

CoinApi.getForcedLivePlayerBalance(uuid); //Database coins
CoinApi.getPlayerBalance(uuid); //Cache if active otherwise Database coins
CoinApi.getUUID(playerName);
CoinApi.updatePlayerBalance(uuid, TransactionType.ADD/REMOVE, 5);

CoinPlayer coinPlayer = new CoinPlayer(uuid);

//Get Stats
coinPlayer.getCoinPlayerBalance();
coinPlayer.getForcedLiveBalance();
coinPlayer.getPlayer();
coinPlayer.getDatabaseId();
coinPlayer.getName();
coinPlayer.getUuid();
coinPlayer.isOnline();

//Update Stats
coinPlayer.setCoinPlayerBalance(new_balance);
coinPlayer.updateCoinPlayerBalance(TransactionType.ADD/REMOVE, value);

//Save
coinPlayer.exportPlayerDataToDatabase();

  • /updatecoins <name,uuid> | system.commands.coins.update
  • /pay <name,uuid> | system.commands.coins.pay
  • /coins [name,uuid] | system.commands.coins.display && system.commands.coins.display.others

Pros:

  • MySQL
  • JSON Files
  • 1 own Event
    • PlayerPayPlayerEvent
  • All Commands editable
  • No command registered in the PluginYML
  • Files update automatically when an update is installed by you, if we should change something in the configs.
  • Pay limit ( Permissions )
  • Default Balance editable for newbies
  • Cache


@EventHandler
public void onPlayerPayPlayerEvent(PlayerPayPlayerEvent event)
{
    Bukkit.getConsoleSender().sendMessage("PlayerPayPlayerEvent");

    CoinPlayer coinPlayer = event.getCoinPlayer();
    CoinPlayer coinTargetPlayer = event.getCoinTargetPlayer();

    int payedCoins = event.getPayedCoins();

    Bukkit.getConsoleSender().sendMessage("[LOG] " + coinPlayer.getName() + " has payed " + payedCoins + " coins to " + coinTargetPlayer.getName() + ".");
    Bukkit.getConsoleSender().sendMessage("");
    Bukkit.getConsoleSender().sendMessage("Account comparisons:");

    Bukkit.getConsoleSender().sendMessage("Payer old: " + event.getOldCoinBalance());
    Bukkit.getConsoleSender().sendMessage("Payer new: " + event.getNewCoinBalance());
    Bukkit.getConsoleSender().sendMessage("");
    Bukkit.getConsoleSender().sendMessage("Receiver old: " + event.getTargetOldCoinBalance());
    Bukkit.getConsoleSender().sendMessage("Receiver new: " + event.getTargetNewCoinBalance());
}

Terms of Service:

You are not allowed to publish my code in any other form. Errors are not written in a review but can be posted via private message or discussion. You are not permitted to sell, give or redistribute this plugin You can't claim this plugin as your own

Information

CategoryEconomy
Published onMay 24, 2023
LicenseUnspecified
Downloads49
Stars0
Watchers0
Library

Members

Avatar for Jens98

Jens98

Owner