mirror of
https://github.com/Shiewk/SModeration.git
synced 2026-04-29 06:34:17 +02:00
Add search option in SMod menu with chat input
This commit is contained in:
@@ -239,4 +239,23 @@ public class Punishment {
|
||||
default -> throw new IllegalStateException("Unknown punishment type " + type);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean matchesSearchQuery(String searchQuery) {
|
||||
if (searchQuery == null) return true;
|
||||
searchQuery = searchQuery.toLowerCase();
|
||||
return reason.toLowerCase().contains(searchQuery)
|
||||
|| by.toString().equalsIgnoreCase(searchQuery)
|
||||
|| to.toString().equalsIgnoreCase(searchQuery)
|
||||
|| getPlayerName().toLowerCase().contains(searchQuery)
|
||||
|| getModeratorName().toLowerCase().contains(searchQuery);
|
||||
|
||||
}
|
||||
|
||||
private String getPlayerName() {
|
||||
return PlayerUtil.offlinePlayerName(to);
|
||||
}
|
||||
|
||||
private String getModeratorName() {
|
||||
return PlayerUtil.offlinePlayerName(by);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user