package me.otisdiver.otisarena.utils;

public class HotbarUtils {

    private static final int[] n9 = {0, 1, 2, 3, 4, 5, 6, 7, 8};
    private static final int[] n8 = {0, 1, 2, 3, 5, 6, 7, 8};
    private static final int[] n7 = {1, 2, 3, 4, 5, 6, 7};
    private static final int[] n6 = {1, 2, 3, 5, 6, 7};
    private static final int[] n5 = {0, 2, 4, 6, 8};
    private static final int[] n4 = {1, 3, 5, 7};
    private static final int[] n3 = {2, 4, 6};
    private static final int[] n2 = {2, 6};
    private static final int[] n1 = {4};
   
    
    /** Positions in the inventory to evenly distribute items. */
    public static int[] getHotbarIndexes(int items) {
        switch(items) {
            case 9:
                return n9;
            case 8:
                return n8;
            case 7:
                return n7;
            case 6:
                return n6;
            case 5:
                return n5;
            case 4:
                return n4;
            case 3:
                return n3;
            case 2:
                return n2;
            case 1:
                return n1;
            default:
                return null;
        }
    }
    
}

@@ -59,16 +59,37 @@
 Utils %7B%0A
+    // @formatter:off
 %0A    pri
@@ -115,737 +115,584 @@
 nt%5B%5D
- n9 = %7B0, 1, 2, 3, 4, 5, 6, 7,
+%5B%5D hotbarIndexes = %7B%0A    //   0  1  2  3  4  5  6  7 
  8
-%7D;
 %0A    
-private static final int%5B%5D n8 = %7B0, 1, 2, 3, 5, 6, 7, 8%7D;%0A    private static final int%5B%5D n7 = %7B1,
+    %7B            4            %7D,%0A        %7B      2,          6      %7D,%0A        %7B     
  2, 
-3,
+  
  4, 
-5, 6, 7%7D;%0A    private static final int%5B%5D n6 = %7B1, 2,
+   6      %7D,%0A        %7B   1,   
  3, 
-5, 6, 7%7D;%0A    private static final int%5B%5D n5 = %7B0, 2, 4, 6, 8%7D;
+   5,    7   %7D,%0A        %7B0,    2,    4,    6,    8%7D,
 %0A    
-private static final int%5B%5D n4 = %7B1, 3, 5, 7%7D;%0A    private static final int%5B%5D n3 = %7B2, 4, 6%7D;%0A    private static final int%5B%5D n2 = %7B2, 6%7D;%0A    private static final int%5B%5D n1 = %7B4%7D;%0A   %0A    %0A    /** Positions in the inventory to evenly distribute items. */%0A    public static int%5B%5D getHotbarIndexes(int items) %7B%0A        switch(items) %7B%0A            case 9:%0A                return n9;%0A            case 8:%0A                return n8;%0A            case 7:%0A               
+    %7B   1, 2, 3,    5, 6, 7   %7D,%0A        %7B   1, 2, 3, 4, 5, 6, 7   %7D,%0A        %7B0, 1, 2, 3,    5, 6, 7, 8%7D,%0A        %7B0, 1, 2, 3, 4, 5, 6, 7, 8%7D%0A    %7D;%0A    // @formatter:on%0A    %0A    /** Positions in the inventory to evenly distribute items. */%0A    public static int%5B%5D getHotbarIndexes(int items) %7B%0A        if (items %3C 1 %7C%7C items %3E 9)
  ret
@@ -696,17 +696,19 @@
 return n
-7
+ull
 ;%0A      
@@ -713,351 +713,45 @@
     
-    case 6:%0A                return n6;%0A            case 5:%0A                return n5;%0A            case 4:%0A                return n4;%0A            case 3:%0A                return n3;%0A            case 2:%0A                return n2;%0A            case 1:%0A                return n1;%0A            default:%0A                return null;%0A        %7D%0A    %7D%0A    
+return hotbarIndexes%5Bitems - 1%5D;%0A    %7D
 %0A%7D%0A

refactor HotbarUtils