API

The DonationPoints API was created in order to allow other plugins to easily hook into some of the methods that DonationPoints uses. The API is added to with just about every update, so I recommend that you come back and check often, to make sure your plugin that hooks into it has not broken. Usually methods aren't removed, just more are added.

All Methods are located at the com.etriacraft.DonationPoints.Methods class.

Notes

  • On anything that alters the accounts in any way, always run the hasAccount method first to prevent a NullPointerException. If hasAccount returns false, don't run the Method.

Methods ==:

  • getBalance(String accountName)
    • This will run through the players table and will return the player's balance. (Double)
  • hasAccount(String accountName)
    • This will run through the players table and determine if the player has an account. (Boolean)
  • createAccount(String accountName)
    • This will create with the specified name. (Make sure to run the hasAccount Method first to prevent error.)
  • addPoints(String accountName, Double amount)
    • This will add the specified amount of points with the specified name.
  • removePoints(String accountName, Double amount)
    • This will remove the specified amount of points from the account with the specified name.
  • setPoints(String accountName, Double amount)
    • This will set the specified account to the specified amount of points.
  • logTransaction(String player, Double price, String packageName, String date, String activated, String expires, String expiredate, String expired)
    • This will log a transaction made by a player.
  • needActive(String player, String packageName)
    • This will check if the player has purchased the specified package and needs to activate it. (Boolean)
  • getCurrentDate()
    • Returns the current date as a String.
  • colorize(String message)
    • Adds color to the message. (Uses ampersands), returns String.
  • hasPurchased(String player, String packageName)
    • Returns true if the player has purchased the specified package, false if not.
  • roundTwoDecimals(Double amount)
    • Returns a decimal rounded out to 2 decimal places. (Great to use this on transfers, etc (Returns Double))
  • purgeEmptyAccounts()
    • Purges all accounts that have a balance of 0.
  • getPackageExists(String pack)
    • Checks if the package exists. (Checks if the price is above 0). Returns true if it exists, false if not.
  • linkFrame(String pack, Double x, Double y, Double z, String world)
    • Links the item frame at the specified location to the specified package.
  • isFrameLinked(Double x, Double y, Double z, String world)
    • Checks if the item frame is already linked.
  • getLinkedPackage(Double x, Double y, Double z, String world)
    • Gets the package linked to the item frame at the specified location. (Make sure to check if the frame is linked)
  • unlinkFrame(Double x, Double y, Double z, String world)
    • Unlinks the item frame at the specified location.
  • deleteAccount(String player)
    • Deletes the specified account.

Comments

Posts Quoted:
Reply
Clear All Quotes