Interface ModuleController
public interface ModuleController
Owns the module tree. It switches modules on and off, keeps the parent-child links, and
answers whether a module currently applies to a given entity.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Set<Class<? extends ModuleSimple>> static final Set<Class<? extends ModuleSimple>> static final Set<Class<? extends ModuleSimple>> static final Set<Class<? extends ModuleSimple>> -
Method Summary
Modifier and TypeMethodDescriptionThe on/off state of every module, keyed by name, for the status command.collectModuleStatuses(Class<? extends ModuleSimple> clazz) The on/off state of one module and everything under it.booleancontainsChild(ModuleSimple module, ModuleName moduleName) Whether a module has the named module somewhere beneath it.voiddisable(ModuleSimple module) Switches one module and everything under it off.voidenable(ModuleSimple module, Predicate<ModuleSimple> enablePredicate) Switches a module on, then walks its children and enables those the test accepts.voidBuilds the module tree and switches on everything the config enables.booleanisDisabledFor(ModuleSimple module, FEntity fEntity) Whether a module does not apply to an entity, taking the config, the permission and the module's own extra condition into account.booleanisDisabledFor(ModuleSimple module, FEntity fEntity, boolean checkLocalizationModule) Whether a module does not apply to an entity, optionally also requiring its text to be available.booleanisEnable(ModuleName moduleName) Whether a module is switched on, looked up by name.booleanisEnable(ModuleSimple abstractModule) Whether a module is switched on.booleanisInstanceOfAny(ModuleSimple module, Set<Class<? extends ModuleSimple>> classes) Whether a module is one of the given types, used with the grouped constants above.voidSwitches every module off, deepest first.
-
Field Details
-
BAN_MODULES
-
MUTE_MODULES
-
WARN_MODULES
-
KICK_MODULES
-
-
Method Details
-
collectModuleStatuses
-
collectModuleStatuses
The on/off state of one module and everything under it.- Parameters:
clazz- the module to start from- Returns:
- the module states
-
isEnable
Whether a module is switched on.- Parameters:
abstractModule- the module- Returns:
- true if it is enabled
-
isEnable
Whether a module is switched on, looked up by name.- Parameters:
moduleName- the module name- Returns:
- true if it is enabled
-
containsChild
Whether a module has the named module somewhere beneath it.- Parameters:
module- the parent modulemoduleName- the child name to look for- Returns:
- true if the child is nested under the parent
-
isDisabledFor
Whether a module does not apply to an entity, taking the config, the permission and the module's own extra condition into account.- Parameters:
module- the modulefEntity- the entity- Returns:
- true if the module is off for this entity
-
isDisabledFor
Whether a module does not apply to an entity, optionally also requiring its text to be available.- Parameters:
module- the modulefEntity- the entitycheckLocalizationModule- whether a missing localization also counts as disabled- Returns:
- true if the module is off for this entity
-
terminate
void terminate()Switches every module off, deepest first. -
disable
Switches one module and everything under it off.- Parameters:
module- the module to disable
-
initialize
void initialize()Builds the module tree and switches on everything the config enables. -
enable
Switches a module on, then walks its children and enables those the test accepts.- Parameters:
module- the module to enableenablePredicate- decides whether a given child is enabled too
-
isInstanceOfAny
Whether a module is one of the given types, used with the grouped constants above.- Parameters:
module- the moduleclasses- the types to test against- Returns:
- true if the module matches any of them
-