11package pl .norbit .treecuter .service ;
22
3- import com .nexomc .nexo .api .NexoBlocks ;
4- import com .nexomc .nexo .mechanics .custom_block .CustomBlockMechanic ;
53import org .bukkit .Material ;
64import org .bukkit .block .Block ;
75import org .bukkit .block .data .type .Leaves ;
8- import org .codehaus .plexus .util .cli .StreamFeeder ;
96import pl .norbit .treecuter .config .Settings ;
107import pl .norbit .treecuter .config .model .CutShape ;
118import pl .norbit .treecuter .utils .item .ItemsAdderUtils ;
@@ -87,7 +84,7 @@ public static void scanLeaves(List<Block> blocks, CutShape cutShape) {
8784 Set <String > woodBlocks = new HashSet <>(cutShape .getAcceptBlocks ());
8885
8986 for (Block leaf : leaves ) {
90- if (isLeafDecaying (leaf , woodBlocks )) {
87+ if (checkBlock (leaf , woodBlocks )) {
9188 decayLeaves .add (leaf );
9289 }
9390 }
@@ -98,7 +95,7 @@ public static void scanLeaves(List<Block> blocks, CutShape cutShape) {
9895 });
9996 }
10097
101- private static boolean isLeafDecaying (Block b , Set <String > woodBlocks ) {
98+ private static boolean checkBlock (Block b , Set <String > woodBlocks ) {
10299 if (b .getBlockData () instanceof Leaves leaves ) {
103100
104101 if (leaves .isPersistent ()) {
@@ -113,6 +110,14 @@ private static boolean isLeafDecaying(Block b, Set<String> woodBlocks) {
113110 return false ;
114111 }
115112
113+ public static boolean isLeaves (Block b ) {
114+ if (b .getBlockData () instanceof Leaves leaves ) {
115+
116+ return !leaves .isPersistent ();
117+
118+ } else return Settings .isAcceptedCustomLeavesBlock (b );
119+ }
120+
116121 private static boolean hasNearby (Block block , Set <String > materials , int [][] offsets ){
117122 for (int [] off : offsets ) {
118123
0 commit comments