use of fr.neatmonster.nocheatplus.checks.CheckType in project NoCheatPlus by NoCheatPlus.
the class NCPHookManager method addHook.
/**
* Register a hook for several individual checks ids (all, group, or an individual checks).
*
* @param checkTypes
* array of check types to register the hook for. If you pass null this hook will be registered for all
* checks
* @param hook
* the hook
* @return the hook id
*/
public static Integer addHook(CheckType[] checkTypes, final NCPHook hook) {
if (checkTypes == null) {
checkTypes = new CheckType[] { CheckType.ALL };
}
final Integer hookId = getId(hook);
for (final CheckType checkType : checkTypes) {
addToMappings(checkType, hook);
}
logHookAdded(hook);
return hookId;
}
use of fr.neatmonster.nocheatplus.checks.CheckType in project NoCheatPlus by NoCheatPlus.
the class RichTypeSetRegistry method addToExistingGroups.
@Override
public <I> void addToExistingGroups(final Collection<CheckType> checkTypes, final Class<I> itemType) {
lock.lock();
for (final CheckType checkType : checkTypes) {
addToExistingGroups(checkType, itemType);
}
lock.unlock();
}
use of fr.neatmonster.nocheatplus.checks.CheckType in project NoCheatPlus by NoCheatPlus.
the class RichTypeSetRegistry method addToGroups.
@Override
public <I> void addToGroups(final Collection<CheckType> checkTypes, final Class<I> itemType, final Class<? super I>... groupTypes) {
lock.lock();
for (final CheckType checkType : checkTypes) {
addToGroups(checkType, itemType, groupTypes);
}
lock.unlock();
}
use of fr.neatmonster.nocheatplus.checks.CheckType in project NoCheatPlus by NoCheatPlus.
the class WorldData method adjustToParent.
/**
* Adjust specific overrides and update.
*
* @param parent
*/
void adjustToParent(final WorldData parent) {
// This may be called during runtime.
this.parent = parent;
this.rawConfiguration = parent.rawConfiguration;
checkTypeTree.setConfigOverrideType(OverrideType.DEFAULT);
for (final CheckType checkType : CheckType.values()) {
checkTypeTree.getNode(checkType).adjustToParent(parent.checkTypeTree.getNode(checkType));
}
// Force update (custom overrides might be persistent, just not on object creation).
checkTypeTree.getNode(CheckType.ALL).update();
// TODO: What if children exist?
}
use of fr.neatmonster.nocheatplus.checks.CheckType in project NoCheatPlus by NoCheatPlus.
the class TestCheckTypeTree method testCreationCompleteness.
@Test
public void testCreationCompleteness() {
CheckTypeTree<TestNode> tree = new CheckTypeTree<TestNode>() {
@Override
protected TestNode newNode(CheckType checkType, TestNode parent, CheckTypeTreeNodeFactory<TestNode> factory) {
return new TestNode(checkType, parent, factory);
}
};
for (CheckType checkType : CheckType.values()) {
TestNode node = tree.getNode(checkType);
CheckType rct = node.getCheckType();
if (rct != checkType) {
fail("Bad check type, expext " + checkType + ", got instead: " + rct);
}
if (rct.getParent() != null && node.getParent().getCheckType() != rct.getParent()) {
fail("Wrong type of parent.");
}
if (node.getChildren().size() != CheckTypeUtil.getDirectChildren(checkType).size()) {
fail("Wrong size of children.");
}
}
if (tree.getNode(null) != null) {
fail("tree.getNode(null) returns a non null node for CheckType: " + tree.getNode(null).getCheckType());
}
}
Aggregations