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+
16## v5.0.1-SNAPSHOT Changelog:
27```
38* Code Cleanup
Original file line number Diff line number Diff line change 66
77 <groupId >xyz.theprogramsrc</groupId >
88 <artifactId >SuperCoreAPI</artifactId >
9- <version >5.0.1-SNAPSHOT </version >
9+ <version >5.0.2 </version >
1010 <packaging >jar</packaging >
1111
1212 <name >SuperCoreAPI</name >
Original file line number Diff line number Diff line change @@ -32,17 +32,19 @@ protected GUIRows getRows() {
3232 return GUIRows .SIX ;
3333 }
3434
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+
3545 @ Override
3646 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 ());
4648 int index0 = this .page * this .maxItemsPerPage ;
4749 int index1 = Math .min (index0 + this .maxItemsPerPage , objectsFound .size ());
4850 int maxPages = (int )Math .round (Math .ceil ((double )objectsFound .size () / (double )maxItemsPerPage ));
You can’t perform that action at this time.
0 commit comments