Class WallStatesPluginLoader
java.lang.Object
net.regsirius06.engine.plugins.loaders.DefaultPluginLoader<WallState>
net.regsirius06.engine.plugins.loaders.WallStatesPluginLoader
- All Implemented Interfaces:
PluginLoader<WallState>
A
PluginLoader implementation for loading WallState plugins.
This class extends DefaultPluginLoader to load plugins of type WallState
and categorizes them into different types based on their generability, emptiness, and light status.
The loader provides methods to retrieve generable wall states, lights, and empty states
separately, and also allows for selecting a random wall state or creating a new random instance
of a WallState plugin.
-
Field Summary
Fields inherited from class net.regsirius06.engine.plugins.loaders.DefaultPluginLoader
log -
Constructor Summary
ConstructorsConstructorDescriptionWallStatesPluginLoader(@NotNull Class<? extends Core> type) Constructs a newWallStatesPluginLoaderfor the given core type. -
Method Summary
Modifier and TypeMethodDescriptionReturns the list of generable empty wall states.Returns the list of generable light wall states.Returns the list of generable wall states.@NotNull WallStategetNewRandomWallState(@NotNull List<? extends WallState> list) Creates and returns a new instance of a randomWallStatefrom the provided list.getRandomWallStateInstance(@NotNull List<? extends WallState> list) Returns a randomWallStatefrom the provided list.voidLoads all availableWallStateplugins and categorizes them into three groups: generable walls, generable lights, and generable empties.Methods inherited from class net.regsirius06.engine.plugins.loaders.DefaultPluginLoader
getPlugin, getPlugins
-
Constructor Details
-
WallStatesPluginLoader
Constructs a newWallStatesPluginLoaderfor the given core type.This constructor initializes the loader and automatically loads the wall state plugins using the
DefaultPluginLoader.loadPlugins()method.- Parameters:
type- the core type to associate with the loader
-
-
Method Details
-
loadPlugins
public void loadPlugins()Loads all availableWallStateplugins and categorizes them into three groups: generable walls, generable lights, and generable empties.Generable walls are walls that are not empty and are not of type
End. Generable lights are walls that have a light state, and generable empties are walls that are empty.- Specified by:
loadPluginsin interfacePluginLoader<WallState>- Overrides:
loadPluginsin classDefaultPluginLoader<WallState>
-
getGenerableWalls
Returns the list of generable wall states.Generable walls are walls that are not empty and are not of type
End.- Returns:
- a list of generable wall states
-
getGenerableLights
Returns the list of generable light wall states.- Returns:
- a list of generable light wall states
-
getGenerableEmpties
Returns the list of generable empty wall states.- Returns:
- a list of generable empty wall states
-
getRandomWallStateInstance
Returns a randomWallStatefrom the provided list.- Parameters:
list- the list from which a random wall state will be selected- Returns:
- a randomly selected wall state
-
getNewRandomWallState
@NotNull public @NotNull WallState getNewRandomWallState(@NotNull @NotNull List<? extends WallState> list) throws RuntimeException Creates and returns a new instance of a randomWallStatefrom the provided list.This method uses reflection to instantiate a new object of the selected
WallStatetype from the list.- Parameters:
list- the list from which a new random wall state will be instantiated- Returns:
- a new instance of a randomly selected wall state
- Throws:
RuntimeException- if there is an error instantiating the wall state
-