Class Database

java.lang.Object
me.therealkeyis.Database

public class Database extends Object
Manages the storage and retrieval of all data necessary for the application that is not considered configuration data
  • Method Details

    • writeNewLocationEntry

      public boolean writeNewLocationEntry(LocationEntry entry)
      Writes a new location entry to the database
      Parameters:
      entry - The entry to be written
      Returns:
      true if successful, false otherwise
    • writeNewUserEntry

      public boolean writeNewUserEntry(UserInfo entry)
      Writes a new UserInfo entry to the database
      Parameters:
      entry - The entry to be written
      Returns:
      true if successful, false otherwise
    • writeNewChannelEntry

      public boolean writeNewChannelEntry(String channelName, String channelId)
      Writes a new Channel entry to the database
      Parameters:
      channelName - The channel name
      channelId - The channel id
      Returns:
      true if successful, false otherwise
    • getSurroundingLocation

      public LocationEntry getSurroundingLocation(LocationPair position)
      Gets the location that surrounds the provided position
      Parameters:
      position - A player's position
      Returns:
      A location entry that surrounds the provieded location. null if none fit criteria
    • getChannelId

      public String getChannelId(String channelName)
      Gets a channel id given a channel name
      Parameters:
      channelName - The channel to look up
      Returns:
      The channel id of the channel provided
    • getAllChannelIds

      public List<String> getAllChannelIds()
      Gets all of the channelIds for the program
      Returns:
      A list of channelIds
    • getGuildId

      public String getGuildId(String minecraftUsername)
      Gets the guild information for the provided minecraft username
      Parameters:
      minecraftUsername - The player's username
      Returns:
      The guild id of the channel the player shares with the bot
    • getDiscordUsername

      public String getDiscordUsername(String minecraftUsername)
      Gets a user's discord username based on the provided minecraft username
      Parameters:
      minecraftUsername - The player's username
      Returns:
      The user id of the player
    • configureInstance

      public static void configureInstance(String path, Logger log)
      Configures the Database instance
      Parameters:
      path - The path to the database folder
      log - The plugin logger
    • getInstance

      public static Database getInstance()
      Gets the global Database instance
      Returns:
      Global instace