File tree Expand file tree Collapse file tree 3 files changed +17
-10
lines changed
src/main/java/xyz/theprogramsrc/supercoreapi/spigot/guis Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Original file line number Diff line number Diff line change
1
+ ## v5.0.2 Changelog:
2
+ ```
3
+ * Added custom filter for Browser GUI
4
+ ```
5
+
1
6
## v5.0.1-SNAPSHOT Changelog:
2
7
```
3
8
* Code Cleanup
Original file line number Diff line number Diff line change 6
6
7
7
<groupId >xyz.theprogramsrc</groupId >
8
8
<artifactId >SuperCoreAPI</artifactId >
9
- <version >5.0.1-SNAPSHOT </version >
9
+ <version >5.0.2 </version >
10
10
<packaging >jar</packaging >
11
11
12
12
<name >SuperCoreAPI</name >
Original file line number Diff line number Diff line change @@ -32,17 +32,19 @@ protected GUIRows getRows() {
32
32
return GUIRows .SIX ;
33
33
}
34
34
35
+ public boolean onItemSearch (OBJ obj ){
36
+ if (this .searchTerm != null ){
37
+ String itemName = this .getSuperUtils ().removeColor (new SimpleItem (this .getButton (obj ).getItemStack ()).getDisplayName ()).toLowerCase ();
38
+ String search = this .getSuperUtils ().removeColor (this .searchTerm ).toLowerCase ();
39
+ return itemName .contains (search );
40
+ }
41
+
42
+ return true ;
43
+ }
44
+
35
45
@ Override
36
46
protected GUIButton [] getButtons () {
37
- List <OBJ > objectsFound = Arrays .stream (this .getObjects ()).filter (obj ->{
38
- if (this .searchTerm != null ){
39
- String itemName = this .getSuperUtils ().removeColor (new SimpleItem (this .getButton (obj ).getItemStack ()).getDisplayName ()).toLowerCase ();
40
- String search = this .getSuperUtils ().removeColor (this .searchTerm ).toLowerCase ();
41
- return itemName .contains (search );
42
- }
43
-
44
- return true ;
45
- }).collect (Collectors .toList ());
47
+ List <OBJ > objectsFound = Arrays .stream (this .getObjects ()).filter (this ::onItemSearch ).collect (Collectors .toList ());
46
48
int index0 = this .page * this .maxItemsPerPage ;
47
49
int index1 = Math .min (index0 + this .maxItemsPerPage , objectsFound .size ());
48
50
int maxPages = (int )Math .round (Math .ceil ((double )objectsFound .size () / (double )maxItemsPerPage ));
You can’t perform that action at this time.
0 commit comments