diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/components/IRemoveData.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/components/IRemoveData.java index 02440f05..e6c5d48b 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/components/IRemoveData.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/components/IRemoveData.java @@ -2,7 +2,9 @@ package fr.neatmonster.nocheatplus.components; /** * Interface for component registration to allow cleanup for player data.
- * NOTE: For CheckType-specific data removal, IHaveCheckType should be implemented, otherwise this data might get ignored until plugin-disable. + * NOTES: + *
  • For CheckType-specific data removal, IHaveCheckType should be implemented, otherwise this data might get ignored until plugin-disable.
  • + *
  • In case of data removal for CheckType.ALL this might get called for either a certain player or all.
  • * @author mc_dev * */ diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/players/DataManager.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/players/DataManager.java index 7d486ec4..9dfaf56f 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/players/DataManager.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/players/DataManager.java @@ -253,14 +253,14 @@ public class DataManager implements Listener, INotifyReload, INeedConfig, Compon 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(); - } - else if (checkType == CheckType.ALL){ + 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); } @@ -302,16 +302,16 @@ public class DataManager implements Listener, INotifyReload, INeedConfig, Compon public static boolean clearComponentData(final CheckType checkType, final String PlayerName){ boolean removed = false; for (final IRemoveData rmd : instance.iRemoveData){ - if (rmd instanceof IHaveCheckType){ + if (checkType == CheckType.ALL){ + // Not sure this is really good, though. + if (rmd.removeData(PlayerName) != null) removed = true; + } + else if (rmd instanceof IHaveCheckType){ final CheckType refType = ((IHaveCheckType) rmd).getCheckType(); if (refType == checkType || APIUtils.isParent(checkType, refType)){ if (rmd.removeData(PlayerName) != null) removed = true; } } - else if (checkType == CheckType.ALL){ - // Not sure this is really good, though. - if (rmd.removeData(PlayerName) != null) removed = true; - } } return removed; }