@@ -39,22 +39,25 @@ public interface CommandPropertiesManager {
39
39
/**
40
40
* The provided {@code configurator} is used to modify commands that possess the specified property.
41
41
* This behavior is added onto any existing behavior.
42
- * When a command is registered with that property (usually an annotation), the provided {@code configurator} is applied.
42
+ * When a command is registered with that property (usually an annotation), the provided {@code configurator} is
43
+ * applied.
43
44
* If there are already commands registered, the {@code configurator} is applied to those as well.
44
45
*
45
46
* @param propertyType the class of the property
46
47
* @param configurator a {@link BiConsumer BiConsumer}.
47
- * The first argument is the property.
48
- * The second argument is the {@link CommandHandleBuilder CommandHandleBuilder} the property is attached to.
49
- * @param <T> the propertyType
48
+ * The first argument is the property.
49
+ * The second argument is the {@link CommandHandleBuilder CommandHandleBuilder} the property is attached to.
50
+ * @param <T> the propertyType
51
+ * @return this, for chaining.
50
52
*/
51
- <T > CommandPropertiesManager bindCommandModifier (Class <T > propertyType , BiConsumer <T , CommandHandleBuilder > configurator );
53
+ <T > CommandPropertiesManager bindCommandModifier (Class <T > propertyType ,
54
+ BiConsumer <T , CommandHandleBuilder > configurator );
52
55
53
56
/**
54
57
* Removes any existing behavior attached to this parameter.
55
58
*
56
59
* @param parameterType the class of the parameter.
57
- * @return this.
60
+ * @return this, for chaining .
58
61
*/
59
62
CommandPropertiesManager clearParameterModifiers (Class <?> parameterType );
60
63
@@ -66,11 +69,13 @@ public interface CommandPropertiesManager {
66
69
*
67
70
* @param propertyType the class of the property
68
71
* @param configurator a {@link BiConsumer BiConsumer}.
69
- * The first argument is the property.
70
- * The second argument is the {@link CommandHandleBuilder CommandHandleBuilder} the property is attached to.
71
- * @param <T> the propertyType
72
+ * The first argument is the property.
73
+ * The second argument is the {@link CommandHandleBuilder CommandHandleBuilder} the property is attached to.
74
+ * @param <T> the propertyType
75
+ * @return this, for chaining.
72
76
*/
73
- <T > CommandPropertiesManager bindParameterModifier (Class <T > propertyType , BiConsumer <T , CommandParameterBuilder > configurator );
77
+ <T > CommandPropertiesManager bindParameterModifier (Class <T > propertyType ,
78
+ BiConsumer <T , CommandParameterBuilder > configurator );
74
79
75
80
/**
76
81
* Applies modifiers to a CommandHandleBuilder based on whether the handle contains a property.
@@ -83,7 +88,7 @@ public interface CommandPropertiesManager {
83
88
* Retrieves a BiConsumer that is used to modify a CommandHandleBuilder.
84
89
*
85
90
* @param propertyType the class of the Property.
86
- * @param <T> the property type.
91
+ * @param <T> the property type.
87
92
* @return a BiConsumer if present, otherwise {@code null}.
88
93
* @see #clearCommandModifiers(Class)
89
94
* @see #bindCommandModifier(Class, BiConsumer)
@@ -95,10 +100,9 @@ public interface CommandPropertiesManager {
95
100
* Applies a modifier that is associated with a certain {@code propertyType} to the passed {@code builder}.
96
101
* If a modifier is not found the {@code builder} is not modified.
97
102
*
98
- *
99
103
* @param propertyType the property class
100
- * @param builder the CommandHandleBuilder to be modified
101
- * @param <T> the property type
104
+ * @param builder the CommandHandleBuilder to be modified
105
+ * @param <T> the property type
102
106
* @see #clearCommandModifiers(Class) (Class)
103
107
* @see #bindCommandModifier(Class, BiConsumer)
104
108
* @see #getCommandModifier(Class)
@@ -116,7 +120,7 @@ public interface CommandPropertiesManager {
116
120
* Retrieves a BiConsumer that is used to modify a CommandParameterBuilder.
117
121
*
118
122
* @param propertyType the class of the Property.
119
- * @param <T> the property type.
123
+ * @param <T> the property type.
120
124
* @return a BiConsumer if present, otherwise {@code null}.
121
125
* @see #clearParameterModifiers(Class)
122
126
* @see #bindParameterModifier(Class, BiConsumer)
@@ -129,68 +133,94 @@ public interface CommandPropertiesManager {
129
133
* If a modifier is not found the {@code builder} is not modified.
130
134
*
131
135
* @param propertyType the property class
132
- * @param builder the CommandHandleBuilder to be modified
133
- * @param <T> the property type
136
+ * @param builder the CommandHandleBuilder to be modified
137
+ * @param <T> the property type
134
138
* @see #clearParameterModifiers(Class) (Class, BiConsumer)
135
139
* @see #bindParameterModifier(Class, BiConsumer)
136
140
* @see #getParameterModifier(Class)
137
141
*/
138
142
<T > void applyParameterModifier (Class <T > propertyType , CommandParameterBuilder builder );
139
143
140
144
/**
141
- * Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the property.
145
+ * Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the
146
+ * property.
142
147
*
143
- * @param identifier a name for the preprocessor
148
+ * @param identifier a name for the preprocessor
144
149
* @param propertyType the property class
145
- * @param function a {@link CommandPreprocessorFunction#process CommandPreprocessorFunction}
150
+ * @param function a {@link CommandPreprocessorFunction#process CommandPreprocessorFunction}
151
+ * @return this, for chaining.
146
152
*/
147
- default CommandPropertiesManager bindPreprocessor (String identifier , Class <?> propertyType , CommandPreprocessorFunction function ) {
148
- bindCommandModifier (propertyType , (t , commandHandleBuilder ) -> commandHandleBuilder .addPreprocessor (new CommandPreprocessor (identifier , function )));
153
+ default CommandPropertiesManager bindPreprocessor (String identifier , Class <?> propertyType ,
154
+ CommandPreprocessorFunction function ) {
155
+ bindCommandModifier (propertyType , (t , commandHandleBuilder ) -> commandHandleBuilder .addPreprocessor (
156
+ new CommandPreprocessor (identifier , function )));
149
157
return this ;
150
158
}
151
159
152
160
/**
153
- * Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the property.
161
+ * Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the
162
+ * property.
154
163
*
155
- * @param identifier a name for the preprocessor
164
+ * @param identifier a name for the preprocessor
156
165
* @param propertyType the property class
157
- * @param factory a function that generates a preprocessor based upon the value of the property
158
- * @param <T> the property type
166
+ * @param factory a function that generates a preprocessor based upon the value of the property
167
+ * @param <T> the property type
168
+ * @return this, for chaining.
159
169
*/
160
- default <T > CommandPropertiesManager bindPreprocessorFactory (String identifier , Class <T > propertyType , Function <T , CommandPreprocessorFunction > factory ) {
161
- bindCommandModifier (propertyType , (t , commandHandleBuilder ) -> commandHandleBuilder .addPreprocessor (new CommandPreprocessor (identifier , factory .apply (t ))));
170
+ default <T > CommandPropertiesManager bindPreprocessorFactory (String identifier , Class <T > propertyType ,
171
+ Function <T , CommandPreprocessorFunction > factory ) {
172
+ bindCommandModifier (propertyType , (t , commandHandleBuilder ) -> commandHandleBuilder .addPreprocessor (
173
+ new CommandPreprocessor (identifier , factory .apply (t ))));
162
174
return this ;
163
175
}
164
176
165
177
/**
166
- * Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the property.
178
+ * Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the
179
+ * property.
167
180
*
168
- * @param identifier a name for the preprocessor
181
+ * @param identifier a name for the preprocessor
169
182
* @param propertyType the property class
170
- * @param predicate a {@link java.util.function.Predicate Predicate}{@literal <}{@link CommandEvent CommandEvent}{@literal >} that returns {@code true} when the command should continue to execute, {@code false} otherwise
183
+ * @param predicate a {@link java.util.function.Predicate Predicate}{@literal <}{@link CommandEvent
184
+ * CommandEvent}{@literal >} that returns {@code true} when the command should continue to execute, {@code false}
185
+ * otherwise
186
+ * @return this, for chaining.
171
187
*/
172
- default CommandPropertiesManager bindPreprocessorPredicate (String identifier , Class <?> propertyType , CommandPreprocessorPredicate predicate ) {
173
- bindCommandModifier (propertyType , (t , commandHandleBuilder ) -> commandHandleBuilder .addPreprocessor (new CommandPreprocessor (identifier , predicate )));
188
+ default CommandPropertiesManager bindPreprocessorPredicate (String identifier , Class <?> propertyType ,
189
+ CommandPreprocessorPredicate predicate ) {
190
+ bindCommandModifier (propertyType , (t , commandHandleBuilder ) -> commandHandleBuilder .addPreprocessor (
191
+ new CommandPreprocessor (identifier , predicate )));
174
192
return this ;
175
193
}
176
194
177
195
/**
178
- * Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the property.
196
+ * Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the
197
+ * property.
179
198
*
180
- * @param identifier a name for the preprocessor
199
+ * @param identifier a name for the preprocessor
181
200
* @param propertyType the property class
182
- * @param factory a function that generates a preprocessor predicate based upon the value of the property
183
- * @param <T> the property type
201
+ * @param factory a function that generates a preprocessor predicate based upon the value of the property
202
+ * @param <T> the property type
203
+ * @return this.
184
204
*/
185
- default <T > CommandPropertiesManager bindPreprocessorPredicateFactory (String identifier , Class <T > propertyType , Function <T , CommandPreprocessorPredicate > factory ) {
186
- bindCommandModifier (propertyType , (t , commandHandleBuilder ) -> commandHandleBuilder .addPreprocessor (new CommandPreprocessor (identifier , factory .apply (t ))));
205
+ default <T > CommandPropertiesManager bindPreprocessorPredicateFactory (String identifier , Class <T > propertyType ,
206
+ Function <T , CommandPreprocessorPredicate >
207
+ factory ) {
208
+ bindCommandModifier (propertyType , (t , commandHandleBuilder ) -> commandHandleBuilder .addPreprocessor (
209
+ new CommandPreprocessor (identifier , factory .apply (t ))));
187
210
return this ;
188
211
}
189
212
190
213
List <String > getPreprocessorPriorityList ();
191
214
192
215
CommandPropertiesManager setPreprocessorPriority (String ... identifiers );
193
216
217
+ /**
218
+ * Sets the order in which preprocessors are evaluated
219
+ *
220
+ * @param identifierList a list of strings that contain the names of each preprocessor. If there is a null value in
221
+ * the list, all unmatched preprocessors will be put in that spot.
222
+ * @return this.
223
+ */
194
224
CommandPropertiesManager setPreprocessorPriority (List <String > identifierList );
195
225
196
226
Comparator <CommandPreprocessor > getPriorityComparator ();
0 commit comments