Search in sources :

Example 1 with IDoRegister

use of fr.neatmonster.nocheatplus.components.registry.setup.IDoRegister in project NoCheatPlus by NoCheatPlus.

the class RegisterInstance method removeSubCheckData.

/**
 * Register for sub check removal.
 *
 * @param checkType
 * @param withDescendantCheckTypes
 * @return
 */
public RegisterInstance<T, A> removeSubCheckData(final CheckType checkType, final boolean withDescendantCheckTypes) {
    if (!IDataOnRemoveSubCheckData.class.isAssignableFrom(type)) {
        throw new UnsupportedOperationException();
    }
    final Collection<CheckType> checkTypes = withDescendantCheckTypes ? CheckTypeUtil.getWithDescendants(checkType) : Arrays.asList(checkType);
    items.add(new IDoRegister() {

        @SuppressWarnings("unchecked")
        @Override
        public void doRegister() {
            factoryRegistry.addToGroups(checkTypes, (Class<? extends IDataOnRemoveSubCheckData>) type, IDataOnRemoveSubCheckData.class);
        }
    });
    return this;
}
Also used : CheckType(fr.neatmonster.nocheatplus.checks.CheckType) IDataOnRemoveSubCheckData(fr.neatmonster.nocheatplus.components.data.IDataOnRemoveSubCheckData) IDoRegister(fr.neatmonster.nocheatplus.components.registry.setup.IDoRegister)

Aggregations

CheckType (fr.neatmonster.nocheatplus.checks.CheckType)1 IDataOnRemoveSubCheckData (fr.neatmonster.nocheatplus.components.data.IDataOnRemoveSubCheckData)1 IDoRegister (fr.neatmonster.nocheatplus.components.registry.setup.IDoRegister)1