Skip to content

Commit 2bd2008

Browse files
author
Francisco Solis
committed
Added Missing Argument
1 parent 529f428 commit 2bd2008

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## v5.0.3 Changelog:
2+
```
3+
* Added missing search term argument
4+
```
5+
16
## v5.0.2 Changelog:
27
```
38
* Added custom filter for Browser GUI

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>xyz.theprogramsrc</groupId>
88
<artifactId>SuperCoreAPI</artifactId>
9-
<version>5.0.2</version>
9+
<version>5.0.3</version>
1010
<packaging>jar</packaging>
1111

1212
<name>SuperCoreAPI</name>

src/main/java/xyz/theprogramsrc/supercoreapi/spigot/guis/BrowserGUI.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,15 @@ 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;
35+
public boolean onItemSearch(OBJ obj, String searchTerm){
36+
String itemName = this.getSuperUtils().removeColor(new SimpleItem(this.getButton(obj).getItemStack()).getDisplayName()).toLowerCase();
37+
String search = this.getSuperUtils().removeColor(searchTerm).toLowerCase();
38+
return itemName.contains(search);
4339
}
4440

4541
@Override
4642
protected GUIButton[] getButtons() {
47-
List<OBJ> objectsFound = Arrays.stream(this.getObjects()).filter(this::onItemSearch).collect(Collectors.toList());
43+
List<OBJ> objectsFound = Arrays.stream(this.getObjects()).filter(obj -> this.onItemSearch(obj, this.searchTerm)).collect(Collectors.toList());
4844
int index0 = this.page * this.maxItemsPerPage;
4945
int index1 = Math.min(index0 + this.maxItemsPerPage, objectsFound.size());
5046
int maxPages = (int)Math.round(Math.ceil((double)objectsFound.size() / (double)maxItemsPerPage));

0 commit comments

Comments
 (0)