Package me.therealkeyis
Class Database
java.lang.Object
me.therealkeyis.Database
Manages the storage and retrieval of all data necessary for the application
that is not considered configuration data
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
configureInstance
(String path, Logger log) Configures the Database instanceGets all of the channelIds for the programgetChannelId
(String channelName) Gets a channel id given a channel namegetDiscordUsername
(String minecraftUsername) Gets a user's discord username based on the provided minecraft usernamegetGuildId
(String minecraftUsername) Gets the guild information for the provided minecraft usernamestatic Database
Gets the global Database instancegetSurroundingLocation
(LocationPair position) Gets the location that surrounds the provided positionboolean
writeNewChannelEntry
(String channelName, String channelId) Writes a new Channel entry to the databaseboolean
Writes a new location entry to the databaseboolean
writeNewUserEntry
(UserInfo entry) Writes a new UserInfo entry to the database
-
Method Details
-
writeNewLocationEntry
Writes a new location entry to the database- Parameters:
entry
- The entry to be written- Returns:
- true if successful, false otherwise
-
writeNewUserEntry
Writes a new UserInfo entry to the database- Parameters:
entry
- The entry to be written- Returns:
- true if successful, false otherwise
-
writeNewChannelEntry
Writes a new Channel entry to the database- Parameters:
channelName
- The channel namechannelId
- The channel id- Returns:
- true if successful, false otherwise
-
getSurroundingLocation
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
Gets a channel id given a channel name- Parameters:
channelName
- The channel to look up- Returns:
- The channel id of the channel provided
-
getAllChannelIds
Gets all of the channelIds for the program- Returns:
- A list of channelIds
-
getGuildId
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
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
Configures the Database instance- Parameters:
path
- The path to the database folderlog
- The plugin logger
-
getInstance
Gets the global Database instance- Returns:
- Global instace
-