Class ContainerManager
java.lang.Object
com.marcusslover.plus.lib.container.ContainerManager
Manages all containers of the server.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends AbstractContainer<?>>
@NotNull Optional<T> Finds a container by its type.voidinit(@NotNull org.bukkit.plugin.Plugin plugin) Initializes all containers.voidregister(@NotNull String parent, @NotNull AbstractContainer<?> container) Registers a new container.voidshutdown()You may want to save all containers before the plugin is disabled.
-
Constructor Details
-
ContainerManager
public ContainerManager()
-
-
Method Details
-
register
public void register(@NotNull @NotNull String parent, @NotNull @NotNull AbstractContainer<?> container) Registers a new container.- Parameters:
parent- Parent folder name.container- Instance of the container.
-
init
public void init(@NotNull @NotNull org.bukkit.plugin.Plugin plugin) Initializes all containers.- Parameters:
plugin- Plugin instance.
-
shutdown
public void shutdown()You may want to save all containers before the plugin is disabled. It's not a mandatory method, but it's recommended. Additionally, it clears the container map after saving. -
getByType
@NotNull public <T extends AbstractContainer<?>> @NotNull Optional<T> getByType(@NotNull @NotNull Class<T> type) Finds a container by its type.- Parameters:
type- Type of the container.- Returns:
- Optional of the container.
-