Class Database

java.lang.Object
org.galliumpowered.database.Database

public class Database extends Object
  • Constructor Details

    • Database

      public Database(String connectionString)
  • Method Details

    • open

      public void open() throws SQLException
      Throws:
      SQLException
    • insertPlayer

      public void insertPlayer(Player player)
      Add a player to the database
      Parameters:
      player - the player
    • insertGroup

      public void insertGroup(Group group)
      Insert a group
      Parameters:
      group - the group
    • playerExists

      public boolean playerExists(Player player) throws SQLException
      Check if a player is in the database
      Parameters:
      player - the player
      Returns:
      whether the player is in the database
      Throws:
      SQLException
    • setPlayerGroup

      public void setPlayerGroup(Player player, @Nullable Group group) throws SQLException
      Set a player's group
      Parameters:
      player - the player
      group - the group
      Throws:
      SQLException
    • getPlayerGroup

      public Optional<Group> getPlayerGroup(Player player)
      Get a player's group
      Parameters:
      player - the player
      Returns:
      player's group
    • getPlayerPermissions

      public ArrayList<String> getPlayerPermissions(Player player)
    • getGroupPrefix

      public Optional<String> getGroupPrefix(Group group)
      Get a group's prefix
      Parameters:
      group - the group
      Returns:
      the prefix
    • setGroupPrefix

      public void setGroupPrefix(Group group, String prefix) throws SQLException
      Set a group's prefix
      Parameters:
      group - the group
      prefix - the prefix
      Throws:
      SQLException
    • getPlayerPrefix

      public String getPlayerPrefix(Player player)
      Get a player's prefix If they are not in a group or don't have a custom prefix, it returns a white prefix
      Parameters:
      player - the player
      Returns:
      the prefix
    • setPlayerPrefix

      public void setPlayerPrefix(Player player, String prefix) throws SQLException
      Set a player's prefix
      Parameters:
      player - the player
      prefix - the prefix
      Throws:
      SQLException
    • insertPermission

      public void insertPermission(String permission, PermissionOwner owner) throws SQLException
      Set a group or player permission
      Parameters:
      permission - the permission to add
      owner - group or player permission owner
      Throws:
      SQLException
    • removePermission

      public void removePermission(String permission, PermissionOwner owner) throws SQLException
      Set a group player or permission
      Parameters:
      permission - the permission to remove
      owner - group or player permission owner
      Throws:
      SQLException
    • playerHasPermission

      public boolean playerHasPermission(String permission, Player player) throws SQLException
      Whether a player has a permission
      Parameters:
      permission - the permission
      player - the player
      Returns:
      whether the player has the specified permission
      Throws:
      SQLException
    • getOwnerPermisions

      public ArrayList<String> getOwnerPermisions(String owner) throws SQLException
      Get an owner's permissions
      Parameters:
      owner - owner name
      Returns:
      ArrayList of permission nodes
      Throws:
      SQLException
    • addGroupsToGroupManager

      public void addGroupsToGroupManager(GroupManager manager) throws SQLException
      Parameters:
      manager - the GroupManager
      Throws:
      SQLException