Skip to content

Commit 8ef3907

Browse files
committed
update javadocs
Signed-off-by: breadmoirai <breadmoirai@gmail.com>
1 parent 21c0bd4 commit 8ef3907

File tree

13 files changed

+382
-328
lines changed

13 files changed

+382
-328
lines changed

src/main/java/com/github/breadmoirai/breadbot/framework/annotation/parameter/Content.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919

2020
/**
2121
* Type of content.
22-
* <ulist>
22+
* <ul>
2323
* <li>{@link Content.Type#RAW}</li>
2424
* <li>{@link Content.Type#STRIPPED}</li>
2525
* <li>{@link Content.Type#DISPLAY}</li>
2626
* <li>{@link Content.Type#RAW_TRIMMED}</li>
27-
* </ulist>
27+
* </ul>
2828
*
2929
* @return the content type.
3030
*/

src/main/java/com/github/breadmoirai/breadbot/framework/builder/BreadBotBuilder.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -576,15 +576,6 @@ public BreadBotBuilder addPreProcessPredicate(Predicate<Message> predicate) {
576576
return this;
577577
}
578578

579-
/**
580-
* Not much use for this at the moment.
581-
*/
582-
public BreadBotBuilder setEventFactory(CommandEventFactory commandEventFactory) {
583-
this.commandEventFactory = commandEventFactory;
584-
return this;
585-
}
586-
587-
588579
/**
589580
* This will allow messages to be re-evaluated on message edit.
590581
* This will also evaluate commands that are unpinned.

src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandParameterBuilder.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public interface CommandParameterBuilder {
112112
* By default this is set to -1.
113113
*
114114
* @param limit An int determining the maximum amount of arguments to contain.
115-
* @return this
115+
* @return this.
116116
*/
117117
CommandParameterBuilder setLimit(int limit);
118118

@@ -132,9 +132,10 @@ default CommandParameterBuilder configure(Consumer<CommandParameterBuilder> conf
132132
CommandParameter build();
133133

134134
/**
135-
* Sets the default mapping for a parameter in case none is found
135+
* Sets the default mapping for a parameter in case none is found.
136136
*
137-
* @param defaultValue a function that produces a value
137+
* @param defaultValue a function that produces a value.
138+
* @return this.
138139
*/
139140
CommandParameterBuilder setDefaultValue(Function<CommandEvent, ?> defaultValue);
140141

src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandPluginBuilder.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,14 @@ public interface CommandPluginBuilder {
6060
* Finds and returns the first Module that is assignable to the provided {@code moduleClass}
6161
*
6262
* @param moduleClass The class of the Module to find
63+
* @param <M> the plugin type
6364
* @return The module if found. Else {@code null}.
6465
*/
6566
<M extends CommandPlugin> M getPlugin(Class<M> moduleClass);
6667

6768
/**
6869
* This adds a module that implements {@link PrefixPlugin} to provide a static prefix that cannot be changed. If a {@link PrefixPlugin} is not added, one will be provided with a static prefix of {@code "!"}
69-
* <p>
70+
*
7071
* <p>This method's implementation is:
7172
* <pre><code> {@link CommandPluginBuilder#addPlugin(CommandPlugin) addModule}(new {@link UnmodifiablePrefixPlugin DefaultPrefixModule}(prefix)) </code></pre>
7273
*
@@ -84,13 +85,13 @@ default CommandPluginBuilder addStaticPrefix(String prefix) {
8485
* This ensures that Commands marked with {@link com.github.breadmoirai.breadbot.plugins.admin.Admin @Admin} are only usable by Administrators.
8586
* <p>It is <b>important</b> to include an implementation of {@link AdminPlugin AdminModule} through either this method, {@link BreadBotBuilder#addAdminPlugin(Predicate)}, or your own implementation.
8687
* Otherwise, all users will have access to Administrative Commands
87-
* <p>
88+
*
8889
* <p>The default criteria for defining an Administrator is as follows:
8990
* <ul>
9091
* <li>Has Kick Members Permission</li>
9192
* <li>Is higher than the bot on the role hierarchy</li>
9293
* </ul>
93-
* <p>
94+
*
9495
* <p>Different criteria to determine which member has administrative status with {@link BreadBotBuilder#addAdminPlugin(Predicate)}
9596
* or your own implementation of {@link AdminPlugin}
9697
*
@@ -102,7 +103,7 @@ default CommandPluginBuilder addAdminPlugin() {
102103

103104
/**
104105
* Define custom behavior to determine which members can use Commands marked with {@link com.github.breadmoirai.breadbot.plugins.admin.Admin @Admin}
105-
* <p>
106+
*
106107
* <p>This method's implementation is:
107108
* <pre><code> {@link #addPlugin(CommandPlugin) addModule}(new {@link AdminPluginImpl DefaultAdminModule}(isAdmin)) </code></pre>
108109
*

src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandPropertiesManager.java

Lines changed: 69 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,25 @@ public interface CommandPropertiesManager {
3939
/**
4040
* The provided {@code configurator} is used to modify commands that possess the specified property.
4141
* 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.
4344
* If there are already commands registered, the {@code configurator} is applied to those as well.
4445
*
4546
* @param propertyType the class of the property
4647
* @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.
5052
*/
51-
<T> CommandPropertiesManager bindCommandModifier(Class<T> propertyType, BiConsumer<T, CommandHandleBuilder> configurator);
53+
<T> CommandPropertiesManager bindCommandModifier(Class<T> propertyType,
54+
BiConsumer<T, CommandHandleBuilder> configurator);
5255

5356
/**
5457
* Removes any existing behavior attached to this parameter.
5558
*
5659
* @param parameterType the class of the parameter.
57-
* @return this.
60+
* @return this, for chaining.
5861
*/
5962
CommandPropertiesManager clearParameterModifiers(Class<?> parameterType);
6063

@@ -66,11 +69,13 @@ public interface CommandPropertiesManager {
6669
*
6770
* @param propertyType the class of the property
6871
* @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.
7276
*/
73-
<T> CommandPropertiesManager bindParameterModifier(Class<T> propertyType, BiConsumer<T, CommandParameterBuilder> configurator);
77+
<T> CommandPropertiesManager bindParameterModifier(Class<T> propertyType,
78+
BiConsumer<T, CommandParameterBuilder> configurator);
7479

7580
/**
7681
* Applies modifiers to a CommandHandleBuilder based on whether the handle contains a property.
@@ -83,7 +88,7 @@ public interface CommandPropertiesManager {
8388
* Retrieves a BiConsumer that is used to modify a CommandHandleBuilder.
8489
*
8590
* @param propertyType the class of the Property.
86-
* @param <T> the property type.
91+
* @param <T> the property type.
8792
* @return a BiConsumer if present, otherwise {@code null}.
8893
* @see #clearCommandModifiers(Class)
8994
* @see #bindCommandModifier(Class, BiConsumer)
@@ -95,10 +100,9 @@ public interface CommandPropertiesManager {
95100
* Applies a modifier that is associated with a certain {@code propertyType} to the passed {@code builder}.
96101
* If a modifier is not found the {@code builder} is not modified.
97102
*
98-
*
99103
* @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
102106
* @see #clearCommandModifiers(Class) (Class)
103107
* @see #bindCommandModifier(Class, BiConsumer)
104108
* @see #getCommandModifier(Class)
@@ -116,7 +120,7 @@ public interface CommandPropertiesManager {
116120
* Retrieves a BiConsumer that is used to modify a CommandParameterBuilder.
117121
*
118122
* @param propertyType the class of the Property.
119-
* @param <T> the property type.
123+
* @param <T> the property type.
120124
* @return a BiConsumer if present, otherwise {@code null}.
121125
* @see #clearParameterModifiers(Class)
122126
* @see #bindParameterModifier(Class, BiConsumer)
@@ -129,68 +133,94 @@ public interface CommandPropertiesManager {
129133
* If a modifier is not found the {@code builder} is not modified.
130134
*
131135
* @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
134138
* @see #clearParameterModifiers(Class) (Class, BiConsumer)
135139
* @see #bindParameterModifier(Class, BiConsumer)
136140
* @see #getParameterModifier(Class)
137141
*/
138142
<T> void applyParameterModifier(Class<T> propertyType, CommandParameterBuilder builder);
139143

140144
/**
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.
142147
*
143-
* @param identifier a name for the preprocessor
148+
* @param identifier a name for the preprocessor
144149
* @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.
146152
*/
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)));
149157
return this;
150158
}
151159

152160
/**
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.
154163
*
155-
* @param identifier a name for the preprocessor
164+
* @param identifier a name for the preprocessor
156165
* @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.
159169
*/
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))));
162174
return this;
163175
}
164176

165177
/**
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.
167180
*
168-
* @param identifier a name for the preprocessor
181+
* @param identifier a name for the preprocessor
169182
* @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.
171187
*/
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)));
174192
return this;
175193
}
176194

177195
/**
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.
179198
*
180-
* @param identifier a name for the preprocessor
199+
* @param identifier a name for the preprocessor
181200
* @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.
184204
*/
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))));
187210
return this;
188211
}
189212

190213
List<String> getPreprocessorPriorityList();
191214

192215
CommandPropertiesManager setPreprocessorPriority(String... identifiers);
193216

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+
*/
194224
CommandPropertiesManager setPreprocessorPriority(List<String> identifierList);
195225

196226
Comparator<CommandPreprocessor> getPriorityComparator();

src/main/java/com/github/breadmoirai/breadbot/framework/command/CommandResultHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/**
2222
* This handles the result of a command, in other terms the returned value from invoking a command method
2323
*
24-
* @param <T>
24+
* @param <T> the result type
2525
*/
2626
@FunctionalInterface
2727
public interface CommandResultHandler<T> {

0 commit comments

Comments
 (0)