Skip to content

Commit

Permalink
Add getCorners() method (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterAssm authored Mar 14, 2020
1 parent 9c59f4d commit 7a89552
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/fr/mrmicky/fastinv/FastInv.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,16 @@ public int[] getBorders() {
return IntStream.range(0, size).filter(i -> size < 27 || i < 9 || i % 9 == 0 || (i - 8) % 9 == 0 || i > size - 9).toArray();
}

/**
* Get corners of the inventory.
*
* @return inventory corners
*/
public int[] getCorners() {
int size = inventory.getSize();
return IntStream.range(0, size).filter(i -> i % 9 == 0 && (i < 10 || i > size - 19) || (i - 1) % 9 == 0 && (i < 2 || i > size - 9) || (i - 7) % 9 == 0 && (i < 9 || i > size - 3) || (i - 8) % 9 == 0 && (i < 18 || i > size - 11)).toArray();
}

/**
* Get the Bukkit inventory
*
Expand Down

0 comments on commit 7a89552

Please sign in to comment.