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

API, CoinSystem, Coin, Coins, Money

Report Coinsystem?

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

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

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

%coinsystem_balance%

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
Downloads43
Stars0
Watchers0

Pinned Versions

Members

Avatar for Jens98

Jens98

Owner