/** 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(); }
/** * Clear player related data, only for registered components (not execution history, violation * history, normal check data).<br> * That should at least go for chat engine data. * * @param CheckType * @param PlayerName * @return If something was removed. */ public static boolean clearComponentData(final CheckType checkType, final String PlayerName) { boolean removed = false; for (final IRemoveData rmd : instance.iRemoveData) { if (rmd instanceof IHaveCheckType) { final CheckType refType = ((IHaveCheckType) rmd).getCheckType(); if (refType == checkType || APIUtils.isParent(checkType, refType)) { if (rmd.removeData(PlayerName) != null) removed = true; } } } return removed; }
/** * 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 (rmd instanceof IHaveCheckType) { final CheckType refType = ((IHaveCheckType) rmd).getCheckType(); if (refType == checkType || APIUtils.isParent(checkType, refType)) rmd.removeAllData(); } } ViolationHistory.clear(checkType); }