@@ -94,6 +94,109 @@ public final class MenuFactory {
94
94
return new Menu (rows , title , modifiers , true );
95
95
}
96
96
97
+ /**
98
+ * Create a new regular Menu with the provided title and rows.
99
+ * <p>
100
+ * This also creates a simple hash set of modifiers which by default is empty.
101
+ * <p>
102
+ * A good example of creation using a method like this:
103
+ * <pre>{@code
104
+ * var plugin = ...;
105
+ * Menu menu = Menus.getFactory().createPaginated("Title", 3);
106
+ * }</pre>
107
+ * @param title the title to name the menu
108
+ * @param rows the rows to add to the menu
109
+ * @return a new Menu with the provided rows and title.
110
+ */
111
+ @ Contract ("_, _ -> new" )
112
+ public @ NotNull PaginatedMenu createPaginated (@ NonNull String title , int rows ) {
113
+ checkRows (rows );
114
+ return new PaginatedMenu (rows , 1 , title , EnumSet .noneOf (Modifier .class ));
115
+ }
116
+
117
+ /**
118
+ * Create a new regular Menu with the provided title and rows.
119
+ * <p>
120
+ * This also creates a simple hash set of modifiers which by default is empty.
121
+ * <p>
122
+ * A good example of creation using a method like this:
123
+ * <pre>{@code
124
+ * var plugin = ...;
125
+ * Menu menu = Menus.getFactory().createPaginated("Title", 3, ...);
126
+ * }</pre>
127
+ * @param title the title to name the menu
128
+ * @param rows the rows to add to the menu
129
+ * @return a new Menu with the provided rows and title.
130
+ */
131
+ @ Contract ("_, _, _ -> new" )
132
+ public @ NotNull PaginatedMenu createPaginated (@ NonNull String title , int rows , int pageSize ) {
133
+ checkRows (rows );
134
+ return new PaginatedMenu (rows , pageSize , title , EnumSet .noneOf (Modifier .class ));
135
+ }
136
+
137
+ /**
138
+ * Create a new regular Menu with the provided title and rows.
139
+ * <p>
140
+ * This also creates a simple hash set of modifiers which by default is empty.
141
+ * <p>
142
+ * A good example of creation using a method like this:
143
+ * <pre>{@code
144
+ * var plugin = ...;
145
+ * Menu menu = Menus.getFactory().createPaginated("Title", 3, ..., true);
146
+ * }</pre>
147
+ * @param title the title to name the menu
148
+ * @param rows the rows to add to the menu
149
+ * @return a new Menu with the provided rows and title.
150
+ */
151
+ @ Contract ("_, _, _, _ -> new" )
152
+ public @ NotNull PaginatedMenu createPaginated (@ NonNull String title , int rows , int pageSize , boolean colorize ) {
153
+ checkRows (rows );
154
+ return new PaginatedMenu (rows , pageSize , title , EnumSet .noneOf (Modifier .class ), colorize );
155
+ }
156
+
157
+ /**
158
+ * Create a new regular Menu with the provided title and rows with the option to colorize it
159
+ * <p>
160
+ * This also creates a simple hash set of modifiers which by default is empty.
161
+ * <p>
162
+ * A good example of creation using a method like this:
163
+ * <pre>{@code
164
+ * var plugin = ...;
165
+ * Menu menu = Menus.getFactory().createPaginated("Title", 3, ..., true, EnumSet.of(Modifier.PREVENT_ITEM_REMOVAL));
166
+ * }</pre>
167
+ * @param title the title to name the menu
168
+ * @param rows the rows to add to the menu
169
+ * @param modifiers a hashset of pre-defined modifiers
170
+ * @param colorize colorize the title or not.
171
+ * @return a new Menu with the provided rows and title.
172
+ */
173
+ @ Contract ("_, _, _, _, _ -> new;" )
174
+ public @ NotNull Menu createPaginated (@ NonNull String title , int rows , int pageSize , boolean colorize , EnumSet <Modifier > modifiers ) {
175
+ checkRows (rows );
176
+ return new Menu (rows , title , modifiers , colorize );
177
+ }
178
+
179
+ /**
180
+ * Create a new regular Menu with the provided title and rows with the option to colorize it
181
+ * <p>
182
+ * This also creates a simple hash set of modifiers which by default is empty.
183
+ * <p>
184
+ * A good example of creation using a method like this:
185
+ * <pre>{@code
186
+ * var plugin = ...;
187
+ * Menu menu = Menus.getFactory().createPaginated("Title", 3, ..., EnumSet.of(Modifier.PREVENT_ITEM_REMOVAL));
188
+ * }</pre>
189
+ * @param title the title to name the menu
190
+ * @param rows the rows to add to the menu
191
+ * @param modifiers a hashset of pre-defined modifiers
192
+ * @return a new Menu with the provided rows and title.
193
+ */
194
+ @ Contract ("_, _, _, _ -> new;" )
195
+ public @ NotNull PaginatedMenu createPaginated (@ NonNull String title , int rows , int pageSize , EnumSet <Modifier > modifiers ) {
196
+ checkRows (rows );
197
+ return new PaginatedMenu (rows , pageSize , title , modifiers , true );
198
+ }
199
+
97
200
private void checkRows (int rows ) {
98
201
if (rows <= 0 ) throw new IllegalArgumentException ("Rows must be greater than 0" );
99
202
else if (rows > 6 ) throw new IllegalArgumentException ("Rows must be equal to 6 or less" );
0 commit comments