API
Implementing MiConomy
Implementing MiConomy is very simple...
//To keep MiConomy API Instance MiConomy economy; public void loadMiConomy() { Plugin plugin = this.getServer().getPluginManager().getPlugin("MiConomy"); //If MiConomy is loaded if(plugin != null) economy = (MiConomy) plugin; else economy = null; }
MiConomy API Functions
All of these functions are accessible through the "economy" variable we made.
//----------API Calls----------// /** * Get MiConomy version * * @return String - MiConomy version */ public String getVersion(); /** * Get this MiConomy type (Release or Beta) * * @return String - Release/Beta */ public String getType(); //----------Other functions----------// /** * Returns the given value rounded to 2 decimal places. * * @param value * - The value to round * @return Double - The rounded value */ public double getRoundedValue(double value); /** * Returns the given value in the correct currency format * * @param value * - The value to format * @return String - The formatted value */ public String getFormattedValue(double value); //----------Accounts----------// /** * Create a new account for the given player * * @param player * - The player * @param balance * - The balance of the account * @param world * - The world to create the account for. * @return Boolean - If successful */ public boolean createAccount(Player player, double balance, World world); /** * Create a new account for the given player * * @param player * - The player * @param balance * - The balance of the account * @param world * - The world of the account * @return Boolean - If successful */ public boolean createAccount(OfflinePlayer player, double balance, World world); /** * Get the balance of a player * * @param player * - The player to retrieve balance from * @param world * - The world of the account * @return Double - The formatted balance of the player */ public double getAccountBalance(Player player, World world); /** * Get the balance of a player * * @param player * - The player to retrieve balance from * @param world * - The world of the account * @return Boolean - The formatted balance of the player */ public double getAccountBalance(OfflinePlayer player, World world); /** * Set a players balance to given amount * * @param player * - The player * @param balance * - The balance to set it to * @param world * - The world of the account * @return Boolean - If successful */ public boolean setAccountBalance(Player player, double balance, World world); /** * Set a players balance to given amount * * @param player * - The player * @param balance * - The balance to set it to * @param world * - The world of the account * @return Boolean - If successful */ public boolean setAccountBalance(OfflinePlayer player, double balance, World world); /** * Add to a players current balance * * @param player * - The player * @param amount * - The amount to add * @param world * - The world of the account * @return Boolean - If successful */ public boolean addAccountBalance(Player player, double amount, World world); /** * Add to a players current balance * * @param player * - The player * @param amount * - The amount to add * @param world * - The world of the account * @return Boolean - If successful */ public boolean addAccountBalance(OfflinePlayer player, double amount, World world); /** * Subtract from a players current balance * * @param player * - The player * @param amount * - The amount to subtract * @param world * - The world of the account * @return Boolean - If successful */ public boolean removeAccountBalance(Player player, double amount, World world); /** * Subtract from a players current balance * * @param player * - The player * @param amount * - The amount to subtract * @param world * - The world of the account * @return Boolean - If successful */ public boolean removeAccountBalance(OfflinePlayer player, double amount, World world); /** * Return if an account exists for the given player * * @param player * - The player * @param world * - The world of the account * @return Boolean - If account exists */ public boolean isAccountCreated(Player player, World world); /** * Return if an account exists for the given player * * @param player * - The player * @param world * - The world of the account * @return Boolean - If account exists */ public boolean isAccountCreated(OfflinePlayer player, World world); /** * Return all players with accounts * * @param world * - The world of the accounts * @return ArrayList - List of players */ public ArrayList<OfflinePlayer> getAccounts(World world); //----------Banks----------// /** * Create a new bank * * @param name * - Name of new bank * @param owners * - Owners of bank * @param members * - Members of bank * @param open * - If bank is public/private * @return Boolean - If successful */ public boolean createBank(String name, ArrayList<OfflinePlayer> owners, ArrayList<String> accounts, boolean open); /** * Delete a bank * * @param name * - Name of existing bank * @return Boolean - If successful */ public boolean deleteBank(String name); /** * Rename a bank * * @param name * - Name of existing bank * @param newName * - New name * @return Boolean - If successful */ public boolean renameBank(String name, String newName); /** * Get balance of a bank * * @param name * - Name of existing bank * @return Double - Formatted bank balance */ public double getBankBalance(String name); /** * Add amount to current bank balance * * @param name * - Name of existing bank * @param amount * - Amount to add * @return Boolean - If successful */ public boolean addBankBalance(String name, double amount); /** * Remove amount from current bank balance * * @param name * - Name of existing bank * @param amount * - Amount to remove * @return Boolean - If successful */ public boolean removeBankBalance(String name, double amount); /** * Set a banks balance to a given amount * * @param name * - Name of existing bank * @param amount * - Amount to set banks balance to * @return Boolean - If successful */ public boolean setBankBalance(String name, double amount); /** * Add new member to a bank * * @param name * - Name of existing bank * @param player * - The player to add * @return Boolean - If successful */ public boolean addBankMember(String name, Player player); /** * Add new member to a bank * * @param name * - Name of existing bank * @param player * - The player to add * @return Boolean - If successful */ public boolean addBankMember(String name, OfflinePlayer player); /** * Remove member from a bank * * @param name * - Name of existing bank * @param player * - The player to remove * @return Boolean - If successful */ public boolean removeBankMember(String name, Player player); /** * Remove member from a bank * * @param name * - Name of existing bank * @param player * - The player to remove * @return Boolean - If successful */ public boolean removeBankMember(String name, OfflinePlayer player); /** * Return whether a player is a member of the given bank * * @param name * - Name of existing bank * @param player * - Player in question * @return Boolean - If given player is a member or not */ public boolean isPlayerBankMember(String name, Player player); /** * Return whether a player is a member of the given bank * * @param name * - Name of existing bank * @param player * - Player in question * @return Boolean - If given player is a member or not */ public boolean isPlayerBankMember(String name, OfflinePlayer player); /** * Add an owner to a bank * * @param name * - Name of existing bank * @param player * - Player to make owner * @return Boolean - If successful */ public boolean addBankOwner(String name, Player player); /** * Add an owner to a bank * * @param name * - Name of existing bank * @param player * - Player to make owner * @return Boolean - If successful */ public boolean addBankOwner(String name, OfflinePlayer player); /** * Remove an owner from a bank * * @param name * - Name of existing bank * @param player * - Player to remove ownership * @return Boolean - If successful */ public boolean removeBankOwner(String name, Player player); /** * Remove an owner from a bank * * @param name * - Name of existing bank * @param player * - Player to remove ownership * @return Boolean - If successful */ public boolean removeBankOwner(String name, OfflinePlayer player); /** * Make bank public/private (open/closed) * * @param name * - Name of existing bank * @param open * - Open or not * @return Boolean - If successful */ public boolean setBankOpen(String name, boolean open); /** * Return whether a bank exists or not * * @param name * - Name of bank in question * @return Boolean - If bank exists or not */ public boolean isBankCreated(String name); /** * Return whether a bank is public or private (open or closed) * * @param name * - Name of existing bank * @return Boolean - If bank is public or private (open or closed) */ public boolean isBankOpen(String name); /** * Return whether a player is a owner of the given bank * * @param name * - Name of existing bank * @param player * - Player in question * @return Boolean - If given player is a bank owner or not */ public boolean isPlayerBankOwner(String name, Player player); /** * Return whether a player is a owner of the given bank * * @param name * - Name of existing bank * @param player * - Player in question * @return Boolean - If given player is a bank owner or not */ public boolean isPlayerBankOwner(String name, OfflinePlayer player); /** * Return ArrayList of all bank owners * * @param name * - Name of existing bank * @return ArrayList - All bank owners */ public ArrayList<String> getBankOwners(String name); /** * Return ArrayList of all bank members * * @param name * - Name of existing bank * @return ArrayList - All bank members */ public ArrayList<String> getBankMembers(String name); /** * Return List of all banks in a given world * * @return List - All banks in given world */ public List<String> getBanks(); //---------- Brackets ----------// /** * Create a new bracket * * @param player * - The owner of new bracket * @param name * - Name of new bracket * @param amount * - Amount of new bracket * @param interval * - Interval of new bracket * @param to * - Array of players to send to * @param world * - World of new bracket * @return Boolean - If successful */ public boolean createBracket(Player player, String name, double amount, int interval, OfflinePlayer[] to, World world); /** * Delete existing bracket * * @param player * - Owner of existing bracket * @param name * - Name of existing bracket * @param world * - World of existing bracket * @return Boolean - If successful */ public boolean deleteBracket(Player player, String name, World world); /** * Add a new receiving player to existing bracket * * @param name * - Name of existing bracket * @param player * - Receiving player to add to existing bracket * @param owner * - Owner of existing bracket * @param world * - World of existing bracket * @return Boolean - If successful */ public boolean addReceiverToBracket(String name, OfflinePlayer player, Player owner, World world); /** * Get the amount given to players for the given bracket * * @param name * - Name of existing bracket * @param owner * - Owner of existing bracket * @param world * - World of existing bracket * @return double - Amount given to players */ public double getBracketAmount(String name, OfflinePlayer owner, World world); /** * Set bracket amount of existing bracket * * @param name * - Name of existing bracket * @param amount * - Amount to set existing bracket to * @param owner * - Owner of existing bracket * @param world * - World of existing bracket * @return Boolean - If successful */ public boolean setBracketAmount(String name, double amount, Player owner, World world); /** * Get the interval of the given bracket * * @param name * - Name of existing bracket * @param owner * - Owner of existing bracket * @param world * - World of existing bracket * @return int - Interval of bracket */ public int getBracketInterval(String name, OfflinePlayer owner, World world); /** * Set interval of existing bracket * * @param name * - Name of existing bracket * @param interval * - Interval to set existing bracket to * @param owner * - Owner of existing bracket * @param world * - World of existing bracket * @return Boolean - If successful */ public boolean setBracketInterval(String name, int interval, Player owner, World world); /** * Remove receiving player from existing bracket * * @param name * - Name of existing bracket * @param player * - Receiving player to remove from existing bracket * @param owner * - Owner of existing bracket * @param world * - World of existing bracket * @return Boolean - If successful */ public boolean removeReceiverFromBracket(String name, OfflinePlayer player, Player owner, World world); /** * Return whether bracket exists or not * * @param name * - Name of bracket in question * @param player * - Owner of bracket in question * @param world * - World of bracket in question * @return Boolean - If bracket in question exists or not */ public boolean isBracketCreated(String name, Player player, World world); /** * Return whether bracket exists or not * * @param name * - Name of bracket in question * @param player * - Owner of bracket in question * @param world * - World of bracket in question * @return * Boolean - If bracket in question exists or not */ public boolean isBracketCreated(String name, OfflinePlayer player, World world); /** * Return all bracket receivers of the given bracket * * @param name * - Name of existing bracket * @param owner * - Owner of existing bracket * @param world * - World of existing bracket * @return ArrayList - All receiving players */ public ArrayList<OfflinePlayer> getBracketReceivers(String name, OfflinePlayer owner, World world); /** * Return List of all brackets a given player owns * * @param player * - The player * @param world * - The world * @return List - All brackets owned by given player */ public List<String> getPlayersBrackets(Player player, World world); /** * Return whether a given player is a receiver of a given bracket * * @param name * - Name of existing bracket * @param player * - Player in question * @param owner * - Owner of existing bracket * @param world * - World of existing bracket * @return Boolean - Whether the given player is a receiver or not */ public boolean isPlayerBracketReceiver(String name, OfflinePlayer player, Player owner, World world); /** * Return List of all brackets a given player owns * * @param player * - The player * @param world * - The world * @return List - All brackets owned by given player */ public List<String> getPlayersBrackets(OfflinePlayer player, World world);
Comments