/** Cleanup method, removes all data and config, but does not call ConfigManager.cleanup. */ public void onDisable() { clearData(CheckType.ALL); for (IRemoveData rmd : iRemoveData) { if (!(rmd instanceof IHaveCheckType)) rmd.removeAllData(); } iRemoveData.clear(); clearConfigs(); lastLogout.clear(); executionHistories.clear(); }
/** * Remove data and history of all players for the given check type and sub checks. * * @param checkType */ public static void clearData(final CheckType checkType) { final Set<CheckDataFactory> factories = new HashSet<CheckDataFactory>(); for (final CheckType type : APIUtils.getWithChildren(checkType)) { final Map<String, ExecutionHistory> map = instance.executionHistories.get(type); if (map != null) map.clear(); final CheckDataFactory factory = type.getDataFactory(); if (factory != null) factories.add(factory); } for (final CheckDataFactory factory : factories) { factory.removeAllData(); } for (final IRemoveData rmd : instance.iRemoveData) { if (checkType == CheckType.ALL) { // Not sure this is really good, though. rmd.removeAllData(); } else if (rmd instanceof IHaveCheckType) { final CheckType refType = ((IHaveCheckType) rmd).getCheckType(); if (refType == checkType || APIUtils.isParent(checkType, refType)) rmd.removeAllData(); } } ViolationHistory.clear(checkType); }