Skip to content

Instantly share code, notes, and snippets.

@brcdev
Created June 16, 2019 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brcdev/7d46c412309b1607296add543cfb2158 to your computer and use it in GitHub Desktop.
Save brcdev/7d46c412309b1607296add543cfb2158 to your computer and use it in GitHub Desktop.
package net.brcdev.shopgui.provider.economy;
import org.bukkit.entity.Player;
public abstract class EconomyProvider {
/**
* Gets the money balance of specified player
*
* @param player Player to check balance
* @return money balance
*/
public abstract double getBalance(Player player);
/**
* Adds the specified money amount to player's balance
*
* @param player Player whose balance shall be modified
* @param amount Money amount
*/
public abstract void deposit(Player player, double amount);
/**
* Removes the specified money amount from player's balance
*
* @param player Player whose balance shall be modified
* @param amount Money amount
*/
public abstract void withdraw(Player player, double amount);
/**
* Checks whether player's balance is equal or higher than the specified money amount
*
* @param player Player whose balance shall be checked
* @param amount Amount required from player
* @return whether player has enough money
*/
public boolean has(Player player, double amount) {
return getBalance(player) >= amount;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment