1111import net .flectone .pulse .module .integration .IntegrationModule ;
1212import net .flectone .pulse .platform .formatter .TimeFormatter ;
1313import net .flectone .pulse .platform .sender .ProxySender ;
14- import net .flectone .pulse .util .checker .MuteChecker ;
1514import net .flectone .pulse .util .constant .ModuleName ;
1615import net .flectone .pulse .util .file .FileFacade ;
17- import org .apache .commons .lang3 .tuple .Pair ;
1816import org .jspecify .annotations .NonNull ;
1917import org .jspecify .annotations .Nullable ;
2018
21- import java .util .Arrays ;
2219import java .util .List ;
2320import java .util .Map ;
2421import java .util .UUID ;
@@ -43,7 +40,9 @@ public void invalidate() {
4340
4441 public void invalidate (UUID uuid ) {
4542 moderationRepository .invalidateAll (uuid );
46- Arrays .stream (MuteChecker .Status .values ()).forEach (status -> playerViolations .remove (Pair .of (uuid , status )));
43+ playerViolations .keySet ().stream ()
44+ .filter (violationKey -> violationKey .sender ().equals (uuid ))
45+ .forEach (playerViolations ::remove );
4746 }
4847
4948 public void invalidateMutes (UUID uuid ) {
@@ -161,15 +160,15 @@ public void addViolation(ViolationKey violationKey, Long violationValue) {
161160 }
162161
163162 public boolean isViolationRestricted (UUID uuid , ModuleSimple moduleSimple , ViolationSetting violationSetting ) {
164- List <Long > timestamps = playerViolations .get (Pair . of (uuid , moduleSimple .name ()));
163+ List <Long > timestamps = playerViolations .get (new ViolationKey (uuid , moduleSimple .name ()));
165164 if (timestamps == null || timestamps .isEmpty ()) return false ;
166165
167166 long currentTimestamp = System .currentTimeMillis ();
168167 return timestamps .stream ().filter (timestamp -> timestamp > currentTimestamp ).count () >= violationSetting .violationLimit ();
169168 }
170169
171170 public Long getFirstViolationTimestamp (UUID uuid , ModuleSimple moduleSimple ) {
172- List <Long > timestamps = playerViolations .get (Pair . of (uuid , moduleSimple .name ()));
171+ List <Long > timestamps = playerViolations .get (new ViolationKey (uuid , moduleSimple .name ()));
173172 if (timestamps == null || timestamps .isEmpty ()) return null ;
174173
175174 return timestamps .getLast ();
0 commit comments