Class AnnoyingLibraryManager

java.lang.Object
net.byteflux.libby.LibraryManager
net.byteflux.libby.BukkitLibraryManager
xyz.srnyx.annoyingapi.library.AnnoyingLibraryManager
All Implemented Interfaces:
Annoyable

public class AnnoyingLibraryManager extends net.byteflux.libby.BukkitLibraryManager implements Annoyable
A library manager that can load libraries into the server's classpath or into an isolated classloader using AnnoyingLibrary
  • Constructor Details

    • AnnoyingLibraryManager

      public AnnoyingLibraryManager(@NotNull @NotNull AnnoyingPlugin plugin)
      Create a new AnnoyingLibraryManager for the plugin
      Parameters:
      plugin - plugin
    • AnnoyingLibraryManager

      public AnnoyingLibraryManager(@NotNull @NotNull AnnoyingPlugin plugin, @NotNull @NotNull String directoryName)
      Create a new AnnoyingLibraryManager for the plugin with a custom directory name
      Parameters:
      plugin - plugin
      directoryName - the name of the directory to store the libraries in
  • Method Details

    • getAnnoyingPlugin

      @NotNull public @NotNull AnnoyingPlugin getAnnoyingPlugin()
      Description copied from interface: Annoyable
      The AnnoyingPlugin instance
      Specified by:
      getAnnoyingPlugin in interface Annoyable
      Returns:
      the plugin instance
    • loadLibrary

      public boolean loadLibrary(@NotNull @NotNull Iterable<AnnoyingLibrary> libraries)
      Load libraries into the server's classpath
      This will stop loading libraries if one fails
      Parameters:
      libraries - the libraries to load
      Returns:
      true if all libraries were loaded successfully, false if ANY failed to load
      See Also:
    • loadLibrary

      public boolean loadLibrary(@NotNull @NotNull AnnoyingLibrary @NotNull ... libraries)
      See Also:
    • loadLibraryIsolated

      @Nullable public @Nullable net.byteflux.libby.classloader.IsolatedClassLoader loadLibraryIsolated(@NotNull @NotNull AnnoyingLibrary library)
      Load a AnnoyingLibrary into an isolated classloader
      AnnoyingLibrary.getRequiredLibraries() is IGNORED when loading isolated libraries, as it is currently not possible to load multiple libraries into the same isolated classloader!
      Parameters:
      library - the library to load
      Returns:
      the isolated classloader containing the library, or null if the library failed to load
      See Also:
    • loadIfNotLoaded

      public boolean loadIfNotLoaded(@NotNull @NotNull AnnoyingLibrary @NotNull ... libraries)
      Load libraries into the server's classpath if they're not already loaded
      This will stop loading libraries if one fails
      Parameters:
      libraries - the libraries to load
      Returns:
      true if all libraries were loaded successfully, false if ANY failed to load
    • loadIfNotLoadedIsolated

      @Nullable public @Nullable net.byteflux.libby.classloader.IsolatedClassLoader loadIfNotLoadedIsolated(@NotNull @NotNull AnnoyingLibrary library)
      Load a AnnoyingLibrary into an isolated classloader if it's not already loaded
      Parameters:
      library - the library to load
      Returns:
      the isolated classloader containing the library, or null if the library failed to load
    • getIsolatedClassLoaderOf

      @NotNull public @NotNull Optional<net.byteflux.libby.classloader.IsolatedClassLoader> getIsolatedClassLoaderOf(@NotNull @NotNull AnnoyingLibrary library)
      Get the IsolatedClassLoader of a AnnoyingLibrary
      Parameters:
      library - the library to get the classloader of
      Returns:
      the classloader of the library
    • isLoaded

      public boolean isLoaded(@NotNull @NotNull AnnoyingLibrary library)
      Check if a AnnoyingLibrary is loaded in the server's classpath
      Parameters:
      library - the library to check
      Returns:
      whether the library is loaded
      See Also:
    • isLoadedIsolated

      public boolean isLoadedIsolated(@NotNull @NotNull AnnoyingLibrary library)
      Check if a AnnoyingLibrary is loaded in an isolated classloader
      Parameters:
      library - the library to check
      Returns:
      whether the library is loaded
      See Also: