Search in sources :

Example 6 with CheckType

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;
}
Also used : CheckType(fr.neatmonster.nocheatplus.checks.CheckType)

Example 7 with CheckType

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();
}
Also used : CheckType(fr.neatmonster.nocheatplus.checks.CheckType)

Example 8 with CheckType

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();
}
Also used : CheckType(fr.neatmonster.nocheatplus.checks.CheckType)

Example 9 with CheckType

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?
}
Also used : CheckType(fr.neatmonster.nocheatplus.checks.CheckType)

Example 10 with CheckType

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());
    }
}
Also used : CheckTypeTreeNodeFactory(fr.neatmonster.nocheatplus.components.data.checktype.CheckTypeTree.CheckTypeTreeNodeFactory) CheckType(fr.neatmonster.nocheatplus.checks.CheckType) CheckTypeTree(fr.neatmonster.nocheatplus.components.data.checktype.CheckTypeTree) Test(org.junit.Test)

Aggregations

CheckType (fr.neatmonster.nocheatplus.checks.CheckType)20 Player (org.bukkit.entity.Player)6 UUID (java.util.UUID)5 IHaveCheckType (fr.neatmonster.nocheatplus.components.registry.feature.IHaveCheckType)2 IRemoveData (fr.neatmonster.nocheatplus.components.registry.feature.IRemoveData)2 Test (org.junit.Test)2 ViolationHistory (fr.neatmonster.nocheatplus.checks.ViolationHistory)1 VLView (fr.neatmonster.nocheatplus.checks.ViolationHistory.VLView)1 ICanHandleTimeRunningBackwards (fr.neatmonster.nocheatplus.components.data.ICanHandleTimeRunningBackwards)1 IData (fr.neatmonster.nocheatplus.components.data.IData)1 IDataOnRemoveSubCheckData (fr.neatmonster.nocheatplus.components.data.IDataOnRemoveSubCheckData)1 CheckTypeTree (fr.neatmonster.nocheatplus.components.data.checktype.CheckTypeTree)1 CheckTypeTreeNodeFactory (fr.neatmonster.nocheatplus.components.data.checktype.CheckTypeTree.CheckTypeTreeNodeFactory)1 CheckRemovalSpec (fr.neatmonster.nocheatplus.components.registry.factory.RichFactoryRegistry.CheckRemovalSpec)1 IDoRegister (fr.neatmonster.nocheatplus.components.registry.setup.IDoRegister)1 RegisteredPermission (fr.neatmonster.nocheatplus.permissions.RegisteredPermission)1 IPlayerData (fr.neatmonster.nocheatplus.players.IPlayerData)1 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1 LinkedList (java.util.LinkedList)1