File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
bukkit/src/main/java/com/blank038/servermarket/api/handler/filter/impl Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change 3
3
import com .blank038 .servermarket .internal .cache .sale .SaleCache ;
4
4
import com .blank038 .servermarket .api .handler .filter .interfaces .IFilter ;
5
5
import lombok .Getter ;
6
+ import org .bukkit .Material ;
6
7
import org .bukkit .inventory .ItemStack ;
7
8
8
9
import java .util .ArrayList ;
@@ -27,7 +28,28 @@ public boolean check(SaleCache saleItem) {
27
28
if (this .types .contains ("all" )) {
28
29
return true ;
29
30
}
30
- return this .types .stream ().anyMatch ((s ) -> saleItem .getSaleTypes ().contains (s ));
31
+ return this .types .stream ().anyMatch ((s ) -> {
32
+ if (s .startsWith ("is:" ) && this .isType (saleItem , s .substring (3 ))) {
33
+ return true ;
34
+ }
35
+ return saleItem .getSaleTypes ().contains (s );
36
+ });
37
+ }
38
+
39
+ private boolean isType (SaleCache saleCache , String type ) {
40
+ Material material = saleCache .getSaleItem ().getType ();
41
+ switch (type .toLowerCase ()) {
42
+ case "block" :
43
+ return material .isBlock ();
44
+ case "edible" :
45
+ return material .isEdible ();
46
+ case "item" :
47
+ return material .isItem ();
48
+ case "burnable" :
49
+ return material .isBurnable ();
50
+ default :
51
+ return false ;
52
+ }
31
53
}
32
54
33
55
@ Override
You can’t perform that action at this time.
0 commit comments