Class Bankaccount

java.lang.Object
nl.minetopiasdb.api.banking.Bankaccount

public class Bankaccount extends Object
The bankaccount object
  • Constructor Details

  • Method Details

    • getId

      public int getId()
      Get the ID of this bankaccount
      Returns:
      id of bankaccount
    • getName

      public String getName()
      Get the name of this bankaccount
      Returns:
      name of bankaccount
    • getType

      public BankAccountType getType()
      Get the BankaccountType of this bankaccount
      Returns:
      type of bankaccount
    • getBalance

      public double getBalance()
      Get the balance of this bankaccount.
      Returns:
      balance of bankaccount
    • setBalance

      public void setBalance(double newBalance)
      Change the balance of this bankaccount.
      Parameters:
      newBalance - new balance of this bankaccount
    • setBalanceSilent

      public void setBalanceSilent(double newBalance)
      We can't just call setBalance(double) whilst updating balances from messagechannels, that would create an infinite loop, which is cool and all but not really useful. This method is for internal use only.
      Parameters:
      newBalance - The new balance.
    • isFrozen

      public boolean isFrozen()
      Check if a bankaccount is frozen
      Returns:
      true if frozen.
    • setFrozen

      public void setFrozen(boolean frozen)
      Freeze a bank account.
      Parameters:
      frozen - true if needs to be frozen.
    • setFrozenSilent

      public void setFrozenSilent(boolean frozen)
      We can't just call setFrozen(boolean) whilst updating frozen state from messagechannels, that would create an infinite loop, which is cool and all but not really useful. This method is for internal use only.
      Parameters:
      frozen - true if needs to be frozen.
    • getAuthorisedUsers

      public List<UUID> getAuthorisedUsers()
      Get a list of users who are authorised to use this bankaccount.
      Returns:
      list of authorised users.
    • getUsers

      public Map<UUID,​BankPermission> getUsers()
      Return a Map of the users with their respective permission on this bankaccount
      Returns:
      map of users
    • hasPermission

      public boolean hasPermission(UUID uuid, BankPermission permission)
      Check if player has provided bankpermission.
      Parameters:
      uuid - uuid of player
      permission - bankpermission
      Returns:
      true if player has permission or has the permission admin
    • setName

      public void setName(String name)
      Change the name of this bankaccount.
      Parameters:
      name - new name of this bankaccount.
    • setNameSilent

      public void setNameSilent(String name)
      Change the name of this bankaccount without communicating it through message channels. Please use setName(String) instead. This method is for internal use only.
      Parameters:
      name - new name of this bankaccount.
    • addUser

      public void addUser(UUID uuid, BankPermission permission)
      Add a user to this bankaccount and give him the provided permission.
      Parameters:
      uuid - uuid of player
      permission - bankpermission
    • addUserSilent

      public void addUserSilent(UUID uuid, BankPermission permission)
      Add a user to this bankaccount and give him the provided permission. Please use addUser(UUID, BankPermission) instead, since this add will be lost on the next reload/restart if you don't. This method is for internal use only.
      Parameters:
      uuid - uuid of player
      permission - bankpermission
    • removeUser

      public void removeUser(UUID uuid)
      Remove a user to this bankaccount. Please call removeUserFromCommand(UUID) as well, since the remove will be lost on the next reload/restart if you don't. This method is for internal use only.
      Parameters:
      uuid - uuid of user who needs to be removed.
    • removeUserSilent

      public void removeUserSilent(UUID uuid)
    • addUser

      @Deprecated public void addUser(UUID user)
      Deprecated.
      This method does not take BankPermissions into account, and assumes BankPermission.ADMIN by default, since that was the behaviour before the change.

      As of v2.3, the preferred way to do this is using addUser(UUID, BankPermission) or addUserSilent(UUID, BankPermission).

      Add a user to this bankaccount. Please call addUserFromCommand(UUID) as well, since the add will be lost on the next reload/restart if you don't.
      Parameters:
      user - user who needs to be added.
    • addUserFromCommand

      @Deprecated public void addUserFromCommand(UUID user)
      Deprecated.
      This method does not take BankPermissions into account, and assumes BankPermission.ADMIN by default, since that was the behaviour before the change.

      As of v2.3, the preferred way to do this is using addUser(UUID, BankPermission).

      Add a user to this bankaccount and communicate the changes with the database & messagechannels (if applicable.)
      Parameters:
      user - user who needs to be added.
    • removeUserFromCommand

      @Deprecated public void removeUserFromCommand(UUID user)
      Deprecated.
      This method does not take BankPermissions into account, and assumes BankPermission.ADMIN by default, since that was the behaviour before the change.

      As of v2.3, the preferred way to do this is using removeUser(UUID).

      Remove a user from this bankaccount and communicate the changes with the database & messagechannels (if applicable.)
      Parameters:
      user - user who needs to be removed.
    • setNameWithoutChannels

      @Deprecated public void setNameWithoutChannels(String name)
      Deprecated.
      This method has been renamed to setNameSilent(String) to remain consistent

      As of v2.3, the preferred way to do this is using setNameSilent(String).

      Change the name of this bankaccount without communicating it through message channels. Please use setName(String) instead.
      Parameters:
      name - new name of this bankaccount.
    • setFrozenWithoutChannels

      @Deprecated public void setFrozenWithoutChannels(boolean frozen)
      Deprecated.
      This method has been renamed to setFrozenSilent(boolean) to remain consistent

      As of v2.3, the preferred way to do this is using setFrozenSilent(boolean).

      We can't just call setFrozen(boolean) whilst updating frozen state from messagechannels, that would create an infinite loop, which is cool and all but not really useful.
      Parameters:
      frozen - true if needs to be frozen.
    • setBalanceWithoutChannels

      @Deprecated public void setBalanceWithoutChannels(double newBalance)
      Deprecated.
      This method has been renamed to setBalanceSilent(double) to remain consistent

      As of v2.3, the preferred way to do this is using setBalanceSilent(double).

      We can't just call setBalance(double) whilst updating balances from messagechannels, that would create an infinite loop, which is cool and all but not really useful.
      Parameters:
      newBalance - The new balance.