Class HyperDatabase


  • public class HyperDatabase
    extends Object
    Class containing the database connection that is used throughout the plugin
    • Constructor Detail

      • HyperDatabase

        @Inject
        public HyperDatabase​(co.aikar.taskchain.TaskChainFactory taskChainFactory,
                             Hyperverse hyperverse)
    • Method Detail

      • attemptConnect

        public boolean attemptConnect()
        Attempt to connect to the database
        Returns:
        True if the connection was successful, false if not
      • attemptClose

        public void attemptClose()
        Attempt to close the connection
      • storeLocation

        public void storeLocation​(@NotNull
                                  @NotNull PersistentLocation persistentLocation,
                                  boolean updateTable,
                                  boolean clear)
        Store the location in the database
        Parameters:
        persistentLocation - Location to store
        updateTable - Whether or not the internal table should be updated
      • clearLocations

        public void clearLocations​(@NotNull
                                   @NotNull UUID uuid)
        Remove all stored locations for a specific UUID
        Parameters:
        uuid - Player UUID
      • getLocations

        public Future<Collection<PersistentLocation>> getLocations​(@NotNull
                                                                   @NotNull UUID uuid)
        Query for locations for a given UUID
        Parameters:
        uuid - Player UUID
        Returns:
        Future that will complete with the locations
      • getLocation

        @NotNull
        public @NotNull Optional<PersistentLocation> getLocation​(@NotNull
                                                                 @NotNull UUID uuid,
                                                                 @NotNull
                                                                 @NotNull String world)
        Get a stored persistent location for a given UUID and world
        Parameters:
        uuid - Player UUID
        world - World
        Returns:
        Optional containing the location, if it was stored
      • clearWorld

        public void clearWorld​(@NotNull
                               @NotNull String worldName)
        Clear all references to a world from the database
        Parameters:
        worldName - World to remove