Skip to content

Commit 9ff4c5c

Browse files
Fix Shifting
1 parent 3db2e3a commit 9ff4c5c

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/main/java/me/flame/menus/menu/iterator/MenuIterator.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Slot shift(Slot oldPos, int maxRows) {
104104

105105
if (oldCol < 9 && oldRow == maxRows) {
106106
oldCol++;
107-
oldRow = 0;
107+
oldRow = 1;
108108
} else {
109109
oldRow++;
110110
}
@@ -117,8 +117,8 @@ Slot shift(Slot oldPos, int maxRows) {
117117

118118
@Override
119119
Slot shift(Slot oldPos, int maxRows) {
120-
int row = oldPos.getRow();
121-
if (row < 0) {
120+
int row = oldPos.getRow() + 1;
121+
if (row < 1) {
122122
row = oldPos.getRow();
123123
}
124124
return new Slot(row, oldPos.getColumn());
@@ -128,9 +128,9 @@ Slot shift(Slot oldPos, int maxRows) {
128128
DOWNWARDS_ONLY {
129129
@Override
130130
Slot shift(Slot oldPos, int maxRows) {
131-
int row = oldPos.getRow()+1;
132-
if(row > maxRows) {
133-
row = oldPos.getRow();
131+
int row = oldPos.getRow() + 1;
132+
if (row > maxRows) {
133+
row = 6;
134134
}
135135
return new Slot(row, oldPos.getColumn());
136136
}
@@ -140,21 +140,21 @@ Slot shift(Slot oldPos, int maxRows) {
140140
RIGHT_ONLY {
141141
@Override
142142
Slot shift(Slot oldPos, int maxRows) {
143-
int col = oldPos.getColumn()+1;
144-
if(col > 8) {
145-
col = oldPos.getColumn();
143+
int col = oldPos.getColumn() + 1;
144+
if (col > 9) {
145+
col = 9;
146146
}
147147
return new Slot(oldPos.getRow(), col);
148148
}
149149
},
150150

151151

152-
LEFT_ONLY{
152+
LEFT_ONLY {
153153
@Override
154154
Slot shift(Slot oldPos, int maxRows) {
155-
int col = oldPos.getColumn()-1;
156-
if(col < 0) {
157-
col = oldPos.getColumn();
155+
int col = oldPos.getColumn() - 1;
156+
if (col < 1) {
157+
col = 1;
158158
}
159159
return new Slot(oldPos.getRow(), col);
160160
}

0 commit comments

Comments
 (0)