diff --git a/build.gradle b/build.gradle index 0e63eb48..8176d733 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ plugins { final author = 'BreadMoirai' final artifactId = 'breadbot-framework' group "com.github.${author.toLowerCase()}" -version '0.10.3' +version '0.11.0' //project.hasProperty never seems to work properly final boolean keysArePresent = false diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/BreadBotClient.java b/src/main/java/com/github/breadmoirai/breadbot/framework/BreadBot.java similarity index 91% rename from src/main/java/com/github/breadmoirai/breadbot/framework/BreadBotClient.java rename to src/main/java/com/github/breadmoirai/breadbot/framework/BreadBot.java index c96d4425..acc4043f 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/BreadBotClient.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/BreadBot.java @@ -26,11 +26,11 @@ import java.util.List; import java.util.Map; -public interface BreadBotClient { +public interface BreadBot { - boolean hasModule(String pluginName); + boolean hasPlugin(String pluginName); - boolean hasModule(Class pluginClass); + boolean hasPlugin(Class pluginClass); T getPlugin(Class pluginClass); diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/CommandPlugin.java b/src/main/java/com/github/breadmoirai/breadbot/framework/CommandPlugin.java index 777fd26a..8c15b8d7 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/CommandPlugin.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/CommandPlugin.java @@ -16,7 +16,7 @@ package com.github.breadmoirai.breadbot.framework; -import com.github.breadmoirai.breadbot.framework.builder.BreadBotClientBuilder; +import com.github.breadmoirai.breadbot.framework.builder.BreadBotBuilder; import com.github.breadmoirai.breadbot.framework.event.CommandEvent; public interface CommandPlugin { @@ -25,14 +25,14 @@ default String getName() { return this.getClass().getSimpleName().replace("Plugin", ""); } - void initialize(BreadBotClientBuilder builder); + void initialize(BreadBotBuilder builder); /** * This method is called when the BreadBotClient has been built. * * @param client */ - default void onBreadReady(BreadBotClient client) { + default void onBreadReady(BreadBot client) { } default void onHelpEvent(CommandEvent event) { diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/builder/BreadBotClientBuilder.java b/src/main/java/com/github/breadmoirai/breadbot/framework/builder/BreadBotBuilder.java similarity index 76% rename from src/main/java/com/github/breadmoirai/breadbot/framework/builder/BreadBotClientBuilder.java rename to src/main/java/com/github/breadmoirai/breadbot/framework/builder/BreadBotBuilder.java index 32159c5b..9cbeb1d4 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/builder/BreadBotClientBuilder.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/builder/BreadBotBuilder.java @@ -16,7 +16,7 @@ package com.github.breadmoirai.breadbot.framework.builder; -import com.github.breadmoirai.breadbot.framework.BreadBotClient; +import com.github.breadmoirai.breadbot.framework.BreadBot; import com.github.breadmoirai.breadbot.framework.CommandPlugin; import com.github.breadmoirai.breadbot.framework.command.Command; import com.github.breadmoirai.breadbot.framework.command.CommandPreprocessor; @@ -52,7 +52,7 @@ import java.util.function.Supplier; import java.util.stream.Collectors; -public class BreadBotClientBuilder implements +public class BreadBotBuilder implements CommandPluginBuilder, CommandHandleBuilderFactory, CommandParameterManagerBuilder, @@ -72,7 +72,7 @@ public class BreadBotClientBuilder implements private CommandEventFactory commandEventFactory; private boolean shouldEvaluateCommandOnMessageUpdate = false; - public BreadBotClientBuilder() { + public BreadBotBuilder() { plugins = new ArrayList<>(); commandProperties = new CommandPropertiesManagerImpl(); argumentTypes = new CommandParameterTypeManagerImpl(); @@ -83,7 +83,7 @@ public BreadBotClientBuilder() { } @Override - public BreadBotClientBuilder addPlugin(Collection plugins) { + public BreadBotBuilder addPlugin(Collection plugins) { Checks.noneNull(plugins, "plugins"); for (CommandPlugin module : plugins) { module.initialize(this); @@ -93,7 +93,7 @@ public BreadBotClientBuilder addPlugin(Collection plugins) { } @Override - public BreadBotClientBuilder addPlugin(CommandPlugin plugin) { + public BreadBotBuilder addPlugin(CommandPlugin plugin) { Checks.notNull(plugin, "plugin"); this.plugins.add(plugin); plugin.initialize(this); @@ -110,7 +110,7 @@ public T getPlugin(Class pluginClass) { return pluginClass == null ? null : plugins.stream().filter(module -> pluginClass.isAssignableFrom(module.getClass())).map(pluginClass::cast).findAny().orElse(null); } - public BreadBotClientBuilder addCommand(Command command) { + public BreadBotBuilder addCommand(Command command) { commands.add(command); return this; } @@ -124,25 +124,25 @@ public CommandHandleBuilder createCommand(Consumer onCommand) { } @Override - public BreadBotClientBuilder addStaticPrefix(String prefix) { + public BreadBotBuilder addStaticPrefix(String prefix) { CommandPluginBuilder.super.addStaticPrefix(prefix); return this; } @Override - public BreadBotClientBuilder addOwnerPlugin(long... owners) { + public BreadBotBuilder addOwnerPlugin(long... owners) { CommandPluginBuilder.super.addOwnerPlugin(owners); return this; } @Override - public BreadBotClientBuilder addAdminPlugin() { + public BreadBotBuilder addAdminPlugin() { CommandPluginBuilder.super.addAdminPlugin(); return this; } @Override - public BreadBotClientBuilder addAdminPlugin(Predicate isAdmin) { + public BreadBotBuilder addAdminPlugin(Predicate isAdmin) { CommandPluginBuilder.super.addAdminPlugin(isAdmin); return this; } @@ -228,161 +228,161 @@ public List createCommandsFromSuppliers(Collection onCommand, Consumer configurator) { + public BreadBotBuilder addCommand(Consumer onCommand, Consumer configurator) { CommandHandleBuilderFactory.super.addCommand(onCommand, configurator); return this; } @Override - public BreadBotClientBuilder addCommand(Class commandClass, Consumer configurator) { + public BreadBotBuilder addCommand(Class commandClass, Consumer configurator) { CommandHandleBuilderFactory.super.addCommand(commandClass, configurator); return this; } @Override - public BreadBotClientBuilder addCommand(Class commandClass) { + public BreadBotBuilder addCommand(Class commandClass) { CommandHandleBuilderFactory.super.addCommand(commandClass); return this; } @Override - public BreadBotClientBuilder addCommand(Object commandObject, Consumer configurator) { + public BreadBotBuilder addCommand(Object commandObject, Consumer configurator) { CommandHandleBuilderFactory.super.addCommand(commandObject, configurator); return this; } @Override - public BreadBotClientBuilder addCommand(Object commandObject) { + public BreadBotBuilder addCommand(Object commandObject) { CommandHandleBuilderFactory.super.addCommand(commandObject); return this; } @Override - public BreadBotClientBuilder addCommand(Supplier commandSupplier, Consumer configurator) { + public BreadBotBuilder addCommand(Supplier commandSupplier, Consumer configurator) { CommandHandleBuilderFactory.super.addCommand(commandSupplier, configurator); return this; } @Override - public BreadBotClientBuilder addCommand(Supplier commandSupplier) { + public BreadBotBuilder addCommand(Supplier commandSupplier) { CommandHandleBuilderFactory.super.addCommand(commandSupplier); return this; } @Override - public BreadBotClientBuilder addCommands(String packageName, Consumer configurator) { + public BreadBotBuilder addCommands(String packageName, Consumer configurator) { CommandHandleBuilderFactory.super.addCommands(packageName, configurator); return this; } @Override - public BreadBotClientBuilder addCommands(String packageName) { + public BreadBotBuilder addCommands(String packageName) { CommandHandleBuilderFactory.super.addCommands(packageName); return this; } @Override - public BreadBotClientBuilder addCommandsFromClasses(Consumer configurator, Class... commandClasses) { + public BreadBotBuilder addCommandsFromClasses(Consumer configurator, Class... commandClasses) { CommandHandleBuilderFactory.super.addCommandsFromClasses(configurator, commandClasses); return this; } @Override - public BreadBotClientBuilder addCommandsFromClasses(Class... commandClasses) { + public BreadBotBuilder addCommandsFromClasses(Class... commandClasses) { CommandHandleBuilderFactory.super.addCommandsFromClasses(commandClasses); return this; } @Override - public BreadBotClientBuilder addCommandsFromObjects(Consumer configurator, Object... commandObjects) { + public BreadBotBuilder addCommandsFromObjects(Consumer configurator, Object... commandObjects) { CommandHandleBuilderFactory.super.addCommandsFromObjects(configurator, commandObjects); return this; } @Override - public BreadBotClientBuilder addCommandsFromObjects(Object... commandObjects) { + public BreadBotBuilder addCommandsFromObjects(Object... commandObjects) { CommandHandleBuilderFactory.super.addCommandsFromObjects(commandObjects); return this; } @Override - public BreadBotClientBuilder addCommandsFromSuppliers(Consumer configurator, Supplier... commandSuppliers) { + public BreadBotBuilder addCommandsFromSuppliers(Consumer configurator, Supplier... commandSuppliers) { CommandHandleBuilderFactory.super.addCommandsFromSuppliers(configurator, commandSuppliers); return this; } @Override - public BreadBotClientBuilder addCommandsFromSuppliers(Supplier... commandSuppliers) { + public BreadBotBuilder addCommandsFromSuppliers(Supplier... commandSuppliers) { CommandHandleBuilderFactory.super.addCommandsFromSuppliers(commandSuppliers); return this; } @Override - public BreadBotClientBuilder addCommandsFromClasses(Collection> commandClasses, Consumer configurator) { + public BreadBotBuilder addCommandsFromClasses(Collection> commandClasses, Consumer configurator) { CommandHandleBuilderFactory.super.addCommandsFromClasses(commandClasses, configurator); return this; } @Override - public BreadBotClientBuilder addCommandsFromClasses(Collection> commandClasses) { + public BreadBotBuilder addCommandsFromClasses(Collection> commandClasses) { CommandHandleBuilderFactory.super.addCommandsFromClasses(commandClasses); return this; } @Override - public BreadBotClientBuilder addCommandsFromObjects(Collection commandObjects, Consumer configurator) { + public BreadBotBuilder addCommandsFromObjects(Collection commandObjects, Consumer configurator) { CommandHandleBuilderFactory.super.addCommandsFromObjects(commandObjects, configurator); return this; } @Override - public BreadBotClientBuilder addCommandsFromObjects(Collection commandObjects) { + public BreadBotBuilder addCommandsFromObjects(Collection commandObjects) { CommandHandleBuilderFactory.super.addCommandsFromObjects(commandObjects); return this; } @Override - public BreadBotClientBuilder addCommandsFromSuppliers(Collection> commandSuppliers, Consumer configurator) { + public BreadBotBuilder addCommandsFromSuppliers(Collection> commandSuppliers, Consumer configurator) { CommandHandleBuilderFactory.super.addCommandsFromSuppliers(commandSuppliers, configurator); return this; } @Override - public BreadBotClientBuilder addCommandsFromSuppliers(Collection> commandSuppliers) { + public BreadBotBuilder addCommandsFromSuppliers(Collection> commandSuppliers) { CommandHandleBuilderFactory.super.addCommandsFromSuppliers(commandSuppliers); return this; } @Override - public BreadBotClientBuilder putCommandModifier(Class propertyType, BiConsumer configurator) { + public BreadBotBuilder putCommandModifier(Class propertyType, BiConsumer configurator) { Checks.notNull(configurator, "configurator"); commandProperties.putCommandModifier(propertyType, configurator); return this; } @Override - public BreadBotClientBuilder addCommandModifier(Class propertyType, BiConsumer configurator) { + public BreadBotBuilder addCommandModifier(Class propertyType, BiConsumer configurator) { Checks.notNull(configurator, "configurator"); commandProperties.appendCommandModifier(propertyType, configurator); return this; } @Override - public BreadBotClientBuilder putParameterModifier(Class propertyType, BiConsumer configurator) { + public BreadBotBuilder putParameterModifier(Class propertyType, BiConsumer configurator) { Checks.notNull(configurator, "configurator"); commandProperties.putParameterModifier(propertyType, configurator); return this; } @Override - public BreadBotClientBuilder addParameterModifier(Class propertyType, BiConsumer configurator) { + public BreadBotBuilder addParameterModifier(Class propertyType, BiConsumer configurator) { Checks.notNull(configurator, "configurator"); commandProperties.appendParameterModifier(propertyType, configurator); return this; } @Override - public BreadBotClientBuilder applyPropertyModifiers(CommandHandleBuilder builder) { + public BreadBotBuilder applyPropertyModifiers(CommandHandleBuilder builder) { commandProperties.applyModifiers(builder); return this; } @@ -393,13 +393,13 @@ public BiConsumer getCommandModifier(Class prope } @Override - public BreadBotClientBuilder applyCommandModifier(Class propertyType, CommandHandleBuilder builder) { + public BreadBotBuilder applyCommandModifier(Class propertyType, CommandHandleBuilder builder) { commandProperties.applyCommandModifier(propertyType, builder); return this; } @Override - public BreadBotClientBuilder applyPropertyModifiers(CommandParameterBuilder builder) { + public BreadBotBuilder applyPropertyModifiers(CommandParameterBuilder builder) { commandProperties.applyModifiers(builder); return this; } @@ -410,31 +410,31 @@ public BiConsumer getParameterModifier(Class } @Override - public BreadBotClientBuilder applyParameterModifier(Class propertyType, CommandParameterBuilder builder) { + public BreadBotBuilder applyParameterModifier(Class propertyType, CommandParameterBuilder builder) { commandProperties.applyParameterModifier(propertyType, builder); return this; } @Override - public BreadBotClientBuilder associatePreprocessorFactory(String identifier, Class propertyType, Function factory) { + public BreadBotBuilder associatePreprocessorFactory(String identifier, Class propertyType, Function factory) { commandProperties.associatePreprocessorFactory(identifier, propertyType, factory); return this; } @Override - public BreadBotClientBuilder associatePreprocessorPredicateFactory(String identifier, Class propertyType, Function factory) { + public BreadBotBuilder associatePreprocessorPredicateFactory(String identifier, Class propertyType, Function factory) { commandProperties.associatePreprocessorPredicateFactory(identifier, propertyType, factory); return this; } @Override - public BreadBotClientBuilder associatePreprocessor(String identifier, Class propertyType, CommandPreprocessorFunction function) { + public BreadBotBuilder associatePreprocessor(String identifier, Class propertyType, CommandPreprocessorFunction function) { commandProperties.associatePreprocessor(identifier, propertyType, function); return this; } @Override - public BreadBotClientBuilder associatePreprocessorPredicate(String identifier, Class propertyType, CommandPreprocessorPredicate predicate) { + public BreadBotBuilder associatePreprocessorPredicate(String identifier, Class propertyType, CommandPreprocessorPredicate predicate) { commandProperties.associatePreprocessorPredicate(identifier, propertyType, predicate); return this; } @@ -445,13 +445,13 @@ public List getPreprocessorPriorityList() { } @Override - public BreadBotClientBuilder setPreprocessorPriority(String... identifiers) { + public BreadBotBuilder setPreprocessorPriority(String... identifiers) { commandProperties.setPreprocessorPriority(identifiers); return this; } @Override - public BreadBotClientBuilder setPreprocessorPriority(List identifierList) { + public BreadBotBuilder setPreprocessorPriority(List identifierList) { commandProperties.setPreprocessorPriority(identifierList); return this; } @@ -462,7 +462,7 @@ public Comparator getPriorityComparator() { } @Override - public BreadBotClientBuilder putTypeParser(Class type, TypeParser parser) { + public BreadBotBuilder putTypeParser(Class type, TypeParser parser) { argumentTypes.putTypeParser(type, parser); return this; } @@ -473,13 +473,13 @@ public TypeParser getTypeParser(Class type) { } @Override - public BreadBotClientBuilder putTypeModifier(Class parameterType, Consumer modifier) { + public BreadBotBuilder putTypeModifier(Class parameterType, Consumer modifier) { argumentTypes.putTypeModifier(parameterType, modifier); return this; } @Override - public BreadBotClientBuilder addTypeModifier(Class parameterType, Consumer modifier) { + public BreadBotBuilder addTypeModifier(Class parameterType, Consumer modifier) { argumentTypes.addTypeModifier(parameterType, modifier); return this; } @@ -490,7 +490,7 @@ public void applyTypeModifiers(CommandParameterBuilder parameterBuilder) { } @Override - public BreadBotClientBuilder registerResultHandler(Class resultType, CommandResultHandler handler) { + public BreadBotBuilder registerResultHandler(Class resultType, CommandResultHandler handler) { resultManager.registerResultHandler(resultType, handler); return this; } @@ -506,7 +506,7 @@ public CommandResultHandler getResultHandler(Class resultType) * @param predicate a predicate which returns {@code true} if a message should be processed as a command. * @return this */ - public BreadBotClientBuilder setPreProcessPredicate(Predicate predicate) { + public BreadBotBuilder setPreProcessPredicate(Predicate predicate) { preProcessPredicate = predicate; return this; } @@ -517,7 +517,7 @@ public BreadBotClientBuilder setPreProcessPredicate(Predicate predicate * @param predicate a predicate which returns {@code true} if a message should be processed as a command. * @return this */ - public BreadBotClientBuilder addPreProcessPredicate(Predicate predicate) { + public BreadBotBuilder addPreProcessPredicate(Predicate predicate) { if (preProcessPredicate == null) { preProcessPredicate = predicate; } else { @@ -529,7 +529,7 @@ public BreadBotClientBuilder addPreProcessPredicate(Predicate predicate /** * Not much use for this at the moment. */ - public BreadBotClientBuilder setEventFactory(CommandEventFactory commandEventFactory) { + public BreadBotBuilder setEventFactory(CommandEventFactory commandEventFactory) { this.commandEventFactory = commandEventFactory; return this; } @@ -543,7 +543,7 @@ public BreadBotClientBuilder setEventFactory(CommandEventFactory commandEventFac * @param shouldEvaluateCommandOnMessageUpdate By default this is {@code true}. * @return this */ - public BreadBotClientBuilder setEvaluateCommandOnMessageUpdate(boolean shouldEvaluateCommandOnMessageUpdate) { + public BreadBotBuilder setEvaluateCommandOnMessageUpdate(boolean shouldEvaluateCommandOnMessageUpdate) { this.shouldEvaluateCommandOnMessageUpdate = shouldEvaluateCommandOnMessageUpdate; return this; } @@ -554,7 +554,7 @@ public BreadBotClientBuilder setEvaluateCommandOnMessageUpdate(boolean shouldEva * * @return a new BreadBotClient. This must be added to JDA with {@link net.dv8tion.jda.core.JDABuilder#addEventListener(Object...)} */ - public BreadBotClient build() { + public BreadBot build() { if (!hasPlugin(PrefixPlugin.class)) plugins.add(new UnmodifiablePrefixPlugin("!")); if (commandEventFactory == null) commandEventFactory = new CommandEventFactoryImpl(getPlugin(PrefixPlugin.class)); diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandHandleBuilder.java b/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandHandleBuilder.java index 9c041d32..f6c54aac 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandHandleBuilder.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandHandleBuilder.java @@ -172,7 +172,7 @@ default CommandHandleBuilder sortPreprocessors(Comparator c */ Method getDeclaringMethod(); - BreadBotClientBuilder getClientBuilder(); + BreadBotBuilder getClientBuilder(); default CommandHandleBuilder sortPreprocessors() { diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandParameterBuilder.java b/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandParameterBuilder.java index 19e45fcd..d892ae04 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandParameterBuilder.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandParameterBuilder.java @@ -32,7 +32,7 @@ */ public interface CommandParameterBuilder { - BreadBotClientBuilder getClientBuilder(); + BreadBotBuilder getClientBuilder(); CommandHandleBuilder getCommandBuilder(); diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandPluginBuilder.java b/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandPluginBuilder.java index 182201df..e145150c 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandPluginBuilder.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandPluginBuilder.java @@ -69,7 +69,7 @@ public interface CommandPluginBuilder { *

This method's implementation is: *

 {@link CommandPluginBuilder#addPlugin(CommandPlugin) addModule}(new {@link UnmodifiablePrefixPlugin DefaultPrefixModule}(prefix)) 
* - *

You can define a different prefix implementation by providing an object to {@link BreadBotClientBuilder#addPlugin(CommandPlugin) addModule(ICommandModule)} that implements {@link PrefixPlugin IPrefixModule} + *

You can define a different prefix implementation by providing an object to {@link BreadBotBuilder#addPlugin(CommandPlugin) addModule(ICommandModule)} that implements {@link PrefixPlugin IPrefixModule} * * @param prefix a string the defines a global prefix * @return this @@ -81,7 +81,7 @@ default CommandPluginBuilder addStaticPrefix(String prefix) { /** * This enables the {@link com.github.breadmoirai.breadbot.plugins.admin.Admin @Admin} annotation that is marked on Command classes. * This ensures that Commands marked with {@link com.github.breadmoirai.breadbot.plugins.admin.Admin @Admin} are only usable by Administrators. - *

It is important to include an implementation of {@link AdminPlugin AdminModule} through either this method, {@link BreadBotClientBuilder#addAdminPlugin(Predicate)}, or your own implementation. + *

It is important to include an implementation of {@link AdminPlugin AdminModule} through either this method, {@link BreadBotBuilder#addAdminPlugin(Predicate)}, or your own implementation. * Otherwise, all users will have access to Administrative Commands *

*

The default criteria for defining an Administrator is as follows: @@ -90,7 +90,7 @@ default CommandPluginBuilder addStaticPrefix(String prefix) { *

  • Is higher than the bot on the role hierarchy
  • * *

    - *

    Different criteria to determine which member has administrative status with {@link BreadBotClientBuilder#addAdminPlugin(Predicate)} + *

    Different criteria to determine which member has administrative status with {@link BreadBotBuilder#addAdminPlugin(Predicate)} * or your own implementation of {@link AdminPlugin} * * @return this diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/command/internal/builder/CommandHandleBuilderFactoryImpl.java b/src/main/java/com/github/breadmoirai/breadbot/framework/command/internal/builder/CommandHandleBuilderFactoryImpl.java index 5b73432f..706094ab 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/command/internal/builder/CommandHandleBuilderFactoryImpl.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/command/internal/builder/CommandHandleBuilderFactoryImpl.java @@ -18,7 +18,7 @@ import com.github.breadmoirai.breadbot.framework.annotation.command.Command; import com.github.breadmoirai.breadbot.framework.annotation.command.MainCommand; -import com.github.breadmoirai.breadbot.framework.builder.BreadBotClientBuilder; +import com.github.breadmoirai.breadbot.framework.builder.BreadBotBuilder; import com.github.breadmoirai.breadbot.framework.builder.CommandParameterBuilder; import com.github.breadmoirai.breadbot.framework.command.internal.CommandObjectFactory; import com.github.breadmoirai.breadbot.framework.command.internal.CommandPropertiesManagerImpl; @@ -55,9 +55,9 @@ public class CommandHandleBuilderFactoryImpl implements CommandHandleBuilderFact private static final Logger log = LoggerFactory.getLogger("CommandBuilder"); - private final BreadBotClientBuilder clientBuilder; + private final BreadBotBuilder clientBuilder; - public CommandHandleBuilderFactoryImpl(BreadBotClientBuilder clientBuilder) { + public CommandHandleBuilderFactoryImpl(BreadBotBuilder clientBuilder) { this.clientBuilder = clientBuilder; } diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/command/internal/builder/CommandHandleBuilderImpl.java b/src/main/java/com/github/breadmoirai/breadbot/framework/command/internal/builder/CommandHandleBuilderImpl.java index 93e3f97c..5f498dc4 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/command/internal/builder/CommandHandleBuilderImpl.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/command/internal/builder/CommandHandleBuilderImpl.java @@ -16,7 +16,7 @@ package com.github.breadmoirai.breadbot.framework.command.internal.builder; -import com.github.breadmoirai.breadbot.framework.builder.BreadBotClientBuilder; +import com.github.breadmoirai.breadbot.framework.builder.BreadBotBuilder; import com.github.breadmoirai.breadbot.framework.builder.CommandHandleBuilder; import com.github.breadmoirai.breadbot.framework.builder.CommandParameterBuilder; import com.github.breadmoirai.breadbot.framework.command.Command; @@ -50,7 +50,7 @@ public class CommandHandleBuilderImpl implements CommandHandleBuilderInternal { private final Method declaringMethod; private String[] keys; private String name, group, description; - private final BreadBotClientBuilder clientBuilder; + private final BreadBotBuilder clientBuilder; private final CommandObjectFactory commandFactory; private final CommandParameterBuilder[] parameterBuilders; private final InvokableCommand commandFunction; @@ -67,7 +67,7 @@ public class CommandHandleBuilderImpl implements CommandHandleBuilderInternal { public CommandHandleBuilderImpl(Object declaringObject, Class declaringClass, Method declaringMethod, - BreadBotClientBuilder clientBuilder, + BreadBotBuilder clientBuilder, CommandObjectFactory commandFactory, CommandParameterBuilder[] parameterBuilders, InvokableCommand commandFunction, @@ -169,7 +169,7 @@ public Object getDeclaringObject() { } @Override - public BreadBotClientBuilder getClientBuilder() { + public BreadBotBuilder getClientBuilder() { return clientBuilder; } diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/event/CommandEvent.java b/src/main/java/com/github/breadmoirai/breadbot/framework/event/CommandEvent.java index 8a5ec729..6f57c6ef 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/event/CommandEvent.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/event/CommandEvent.java @@ -16,7 +16,7 @@ package com.github.breadmoirai.breadbot.framework.event; -import com.github.breadmoirai.breadbot.framework.BreadBotClient; +import com.github.breadmoirai.breadbot.framework.BreadBot; import com.github.breadmoirai.breadbot.framework.command.Command; import com.github.breadmoirai.breadbot.framework.parameter.CommandArgument; import com.github.breadmoirai.breadbot.framework.parameter.CommandArgumentList; @@ -60,18 +60,18 @@ public static void setDefaultArgumentLimit(int limit) { DEFAULT_LIMIT = limit; } - private final BreadBotClient client; + private final BreadBot client; private final boolean isHelpEvent; protected CommandArgumentList argumentList; - public CommandEvent(JDA api, long responseNumber, BreadBotClient client, boolean isHelpEvent) { + public CommandEvent(JDA api, long responseNumber, BreadBot client, boolean isHelpEvent) { super(api, responseNumber); this.client = client; this.isHelpEvent = isHelpEvent; } - public BreadBotClient getClient() { + public BreadBot getClient() { return client; } diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/event/CommandEventFactory.java b/src/main/java/com/github/breadmoirai/breadbot/framework/event/CommandEventFactory.java index 3659f44e..cd7dfe81 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/event/CommandEventFactory.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/event/CommandEventFactory.java @@ -16,7 +16,7 @@ package com.github.breadmoirai.breadbot.framework.event; -import com.github.breadmoirai.breadbot.framework.BreadBotClient; +import com.github.breadmoirai.breadbot.framework.BreadBot; import com.github.breadmoirai.breadbot.framework.event.internal.CommandEventInternal; import net.dv8tion.jda.core.entities.Message; import net.dv8tion.jda.core.events.message.guild.GenericGuildMessageEvent; @@ -26,5 +26,5 @@ */ public interface CommandEventFactory { - CommandEventInternal createEvent(GenericGuildMessageEvent event, Message message, BreadBotClient client); + CommandEventInternal createEvent(GenericGuildMessageEvent event, Message message, BreadBot client); } \ No newline at end of file diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/event/internal/CommandEventFactoryImpl.java b/src/main/java/com/github/breadmoirai/breadbot/framework/event/internal/CommandEventFactoryImpl.java index 1b76fe0d..9dbc03ef 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/event/internal/CommandEventFactoryImpl.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/event/internal/CommandEventFactoryImpl.java @@ -16,7 +16,7 @@ package com.github.breadmoirai.breadbot.framework.event.internal; -import com.github.breadmoirai.breadbot.framework.BreadBotClient; +import com.github.breadmoirai.breadbot.framework.BreadBot; import com.github.breadmoirai.breadbot.framework.event.CommandEventFactory; import com.github.breadmoirai.breadbot.plugins.prefix.PrefixPlugin; import com.github.breadmoirai.breadbot.util.DiscordPatterns; @@ -35,7 +35,7 @@ public CommandEventFactoryImpl(PrefixPlugin prefixSupplier) { } @Override - public CommandEventInternal createEvent(GenericGuildMessageEvent event, Message message, BreadBotClient client) { + public CommandEventInternal createEvent(GenericGuildMessageEvent event, Message message, BreadBot client) { String prefix = prefixModule.getPrefix(event.getGuild()); String contentRaw = message.getContentRaw(); final Matcher matcher = DiscordPatterns.USER_MENTION_PREFIX.matcher(contentRaw); @@ -58,7 +58,7 @@ private String getMyId(GenericGuildMessageEvent event) { return myId; } - private CommandEventInternal parseContent(GenericGuildMessageEvent event, Message message, BreadBotClient client, String prefix, String contentRaw) { + private CommandEventInternal parseContent(GenericGuildMessageEvent event, Message message, BreadBot client, String prefix, String contentRaw) { final String[] split = splitContent(contentRaw); final String key = split[0]; final String content = split[1]; diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/event/internal/CommandEventInternal.java b/src/main/java/com/github/breadmoirai/breadbot/framework/event/internal/CommandEventInternal.java index 4088db30..02b1396e 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/event/internal/CommandEventInternal.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/event/internal/CommandEventInternal.java @@ -15,7 +15,7 @@ */ package com.github.breadmoirai.breadbot.framework.event.internal; -import com.github.breadmoirai.breadbot.framework.BreadBotClient; +import com.github.breadmoirai.breadbot.framework.BreadBot; import com.github.breadmoirai.breadbot.framework.command.Command; import com.github.breadmoirai.breadbot.framework.event.CommandEvent; import com.github.breadmoirai.breadbot.framework.response.CommandResponseManager; @@ -31,7 +31,7 @@ public abstract class CommandEventInternal extends CommandEvent { private Command command; private CommandResponseManager manager; - public CommandEventInternal(JDA api, long responseNumber, BreadBotClient client, boolean isHelpEvent) { + public CommandEventInternal(JDA api, long responseNumber, BreadBot client, boolean isHelpEvent) { super(api, responseNumber, client, isHelpEvent); manager = CommandResponseManager.factory.get(); } diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/event/internal/MessageReceivedCommandEvent.java b/src/main/java/com/github/breadmoirai/breadbot/framework/event/internal/MessageReceivedCommandEvent.java index 2f4dad07..0cdb1823 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/event/internal/MessageReceivedCommandEvent.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/event/internal/MessageReceivedCommandEvent.java @@ -16,7 +16,7 @@ package com.github.breadmoirai.breadbot.framework.event.internal; -import com.github.breadmoirai.breadbot.framework.BreadBotClient; +import com.github.breadmoirai.breadbot.framework.BreadBot; import net.dv8tion.jda.core.JDA; import net.dv8tion.jda.core.entities.Guild; import net.dv8tion.jda.core.entities.Member; @@ -39,7 +39,7 @@ public class MessageReceivedCommandEvent extends CommandEventInternal { private String[] key; private String content; - MessageReceivedCommandEvent(BreadBotClient client, GenericGuildMessageEvent event, Message message, String prefix, String[] key, String content, boolean isHelpEvent) { + MessageReceivedCommandEvent(BreadBot client, GenericGuildMessageEvent event, Message message, String prefix, String[] key, String content, boolean isHelpEvent) { super(event.getJDA(), event.getResponseNumber(), client, isHelpEvent); this.event = event; this.message = message; diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/internal/BreadBotClientImpl.java b/src/main/java/com/github/breadmoirai/breadbot/framework/internal/BreadBotClientImpl.java index cbe8552d..98b0a87a 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/internal/BreadBotClientImpl.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/internal/BreadBotClientImpl.java @@ -16,7 +16,7 @@ package com.github.breadmoirai.breadbot.framework.internal; -import com.github.breadmoirai.breadbot.framework.BreadBotClient; +import com.github.breadmoirai.breadbot.framework.BreadBot; import com.github.breadmoirai.breadbot.framework.CommandPlugin; import com.github.breadmoirai.breadbot.framework.command.Command; import com.github.breadmoirai.breadbot.framework.command.CommandEngine; @@ -48,9 +48,9 @@ import java.util.Map; import java.util.function.Predicate; -public class BreadBotClientImpl implements BreadBotClient, EventListener { +public class BreadBotClientImpl implements BreadBot, EventListener { - private static final Logger LOG = LoggerFactory.getLogger(BreadBotClient.class); + private static final Logger LOG = LoggerFactory.getLogger(BreadBot.class); private JDA jda; @@ -178,12 +178,12 @@ public Map getCommandMap() { } @Override - public boolean hasModule(String pluginName) { + public boolean hasPlugin(String pluginName) { return pluginName != null && modules.stream().map(CommandPlugin::getName).anyMatch(pluginName::equalsIgnoreCase); } @Override - public boolean hasModule(Class pluginClass) { + public boolean hasPlugin(Class pluginClass) { return moduleTypeMap.containsKey(pluginClass); } diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/parameter/CommandArgument.java b/src/main/java/com/github/breadmoirai/breadbot/framework/parameter/CommandArgument.java index 8fd3e4b8..afacf55d 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/parameter/CommandArgument.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/parameter/CommandArgument.java @@ -16,7 +16,7 @@ package com.github.breadmoirai.breadbot.framework.parameter; -import com.github.breadmoirai.breadbot.framework.BreadBotClient; +import com.github.breadmoirai.breadbot.framework.BreadBot; import com.github.breadmoirai.breadbot.framework.event.CommandEvent; import com.github.breadmoirai.breadbot.util.Arguments; import com.github.breadmoirai.breadbot.util.Emoji; @@ -56,7 +56,7 @@ public interface CommandArgument { * * @return a BreadBotClient */ - default BreadBotClient getClient() { + default BreadBot getClient() { return getEvent().getClient(); } diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/parameter/internal/builder/CollectionTypes.java b/src/main/java/com/github/breadmoirai/breadbot/framework/parameter/internal/builder/CollectionTypes.java index 934de1a0..d0360ac1 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/parameter/internal/builder/CollectionTypes.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/parameter/internal/builder/CollectionTypes.java @@ -16,7 +16,7 @@ package com.github.breadmoirai.breadbot.framework.parameter.internal.builder; -import com.github.breadmoirai.breadbot.framework.builder.BreadBotClientBuilder; +import com.github.breadmoirai.breadbot.framework.builder.BreadBotBuilder; import com.github.breadmoirai.breadbot.framework.builder.CommandParameterBuilder; import com.github.breadmoirai.breadbot.framework.parameter.CommandArgument; import com.github.breadmoirai.breadbot.framework.parameter.TypeParser; @@ -36,7 +36,7 @@ private CollectionTypes() { private static void setTypeParser(Class type, CommandParameterBuilder builder) { - final BreadBotClientBuilder clientBuilder = builder.getClientBuilder(); + final BreadBotBuilder clientBuilder = builder.getClientBuilder(); final TypeParser typeParser = clientBuilder.getTypeParser(type); builder.setTypeParser(typeParser); } diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/parameter/internal/builder/CommandParameterBuilderImpl.java b/src/main/java/com/github/breadmoirai/breadbot/framework/parameter/internal/builder/CommandParameterBuilderImpl.java index 102b7b62..342c953b 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/parameter/internal/builder/CommandParameterBuilderImpl.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/parameter/internal/builder/CommandParameterBuilderImpl.java @@ -17,7 +17,7 @@ package com.github.breadmoirai.breadbot.framework.parameter.internal.builder; import com.github.breadmoirai.breadbot.framework.CommandPlugin; -import com.github.breadmoirai.breadbot.framework.builder.BreadBotClientBuilder; +import com.github.breadmoirai.breadbot.framework.builder.BreadBotBuilder; import com.github.breadmoirai.breadbot.framework.builder.CommandHandleBuilder; import com.github.breadmoirai.breadbot.framework.builder.CommandParameterBuilder; import com.github.breadmoirai.breadbot.framework.command.internal.CommandPropertyMapImpl; @@ -52,7 +52,7 @@ public class CommandParameterBuilderImpl implements CommandParameterBuilder { private final CommandHandleBuilder commandBuilder; private final Parameter parameter; private final CommandPropertyMapImpl map; - private final BreadBotClientBuilder clientBuilder; + private final BreadBotBuilder clientBuilder; private String paramName; private int index = 0; private int width = 1; @@ -64,7 +64,7 @@ public class CommandParameterBuilderImpl implements CommandParameterBuilder { private AbsentArgumentHandler absentArgumentHandler = null; private Predicate argumentPredicate; - public CommandParameterBuilderImpl(BreadBotClientBuilder builder, CommandHandleBuilder commandBuilder, Parameter parameter, CommandPropertyMapImpl map) { + public CommandParameterBuilderImpl(BreadBotBuilder builder, CommandHandleBuilder commandBuilder, Parameter parameter, CommandPropertyMapImpl map) { this.commandBuilder = commandBuilder; this.parameter = parameter; this.clientBuilder = builder; @@ -170,7 +170,7 @@ public CommandParameterBuilder configure(Consumer confi } @Override - public BreadBotClientBuilder getClientBuilder() { + public BreadBotBuilder getClientBuilder() { return clientBuilder; } diff --git a/src/main/java/com/github/breadmoirai/breadbot/plugins/admin/AdminPlugin.java b/src/main/java/com/github/breadmoirai/breadbot/plugins/admin/AdminPlugin.java index 2a1ca384..50585171 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/plugins/admin/AdminPlugin.java +++ b/src/main/java/com/github/breadmoirai/breadbot/plugins/admin/AdminPlugin.java @@ -17,7 +17,7 @@ package com.github.breadmoirai.breadbot.plugins.admin; import com.github.breadmoirai.breadbot.framework.CommandPlugin; -import com.github.breadmoirai.breadbot.framework.builder.BreadBotClientBuilder; +import com.github.breadmoirai.breadbot.framework.builder.BreadBotBuilder; import net.dv8tion.jda.core.entities.Member; public interface AdminPlugin extends CommandPlugin { @@ -30,7 +30,7 @@ default String getName() { boolean isAdmin(Member member); @Override - default void initialize(BreadBotClientBuilder builder) { + default void initialize(BreadBotBuilder builder) { builder.associatePreprocessorPredicate("admin", Admin.class, event -> isAdmin(event.getMember())); builder.addCommand(AdminCommand.class); } diff --git a/src/main/java/com/github/breadmoirai/breadbot/plugins/owner/OwnerPlugin.java b/src/main/java/com/github/breadmoirai/breadbot/plugins/owner/OwnerPlugin.java index 3f33dc7a..adbc5b07 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/plugins/owner/OwnerPlugin.java +++ b/src/main/java/com/github/breadmoirai/breadbot/plugins/owner/OwnerPlugin.java @@ -1,7 +1,7 @@ package com.github.breadmoirai.breadbot.plugins.owner; import com.github.breadmoirai.breadbot.framework.CommandPlugin; -import com.github.breadmoirai.breadbot.framework.builder.BreadBotClientBuilder; +import com.github.breadmoirai.breadbot.framework.builder.BreadBotBuilder; import net.dv8tion.jda.core.entities.Member; public abstract class OwnerPlugin implements CommandPlugin { @@ -9,7 +9,7 @@ public abstract class OwnerPlugin implements CommandPlugin { public abstract boolean isOwner(Member member); @Override - public final void initialize(BreadBotClientBuilder builder) { + public final void initialize(BreadBotBuilder builder) { builder.associatePreprocessorPredicate("owner", Owner.class, event -> isOwner(event.getMember())); } diff --git a/src/main/java/com/github/breadmoirai/breadbot/plugins/prefix/PrefixPlugin.java b/src/main/java/com/github/breadmoirai/breadbot/plugins/prefix/PrefixPlugin.java index 3e4f52ac..8a99eed8 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/plugins/prefix/PrefixPlugin.java +++ b/src/main/java/com/github/breadmoirai/breadbot/plugins/prefix/PrefixPlugin.java @@ -17,7 +17,7 @@ package com.github.breadmoirai.breadbot.plugins.prefix; import com.github.breadmoirai.breadbot.framework.CommandPlugin; -import com.github.breadmoirai.breadbot.framework.builder.BreadBotClientBuilder; +import com.github.breadmoirai.breadbot.framework.builder.BreadBotBuilder; import net.dv8tion.jda.core.entities.Guild; /** @@ -26,7 +26,7 @@ public interface PrefixPlugin extends CommandPlugin { @Override - default void initialize(BreadBotClientBuilder client) { + default void initialize(BreadBotBuilder client) { client.addCommand(PrefixCommand.class); } diff --git a/src/test/java/com/github/breadmoirai/tests/ClientTest.java b/src/test/java/com/github/breadmoirai/tests/ClientTest.java index fa4a66ee..1d249326 100644 --- a/src/test/java/com/github/breadmoirai/tests/ClientTest.java +++ b/src/test/java/com/github/breadmoirai/tests/ClientTest.java @@ -16,8 +16,8 @@ package com.github.breadmoirai.tests; -import com.github.breadmoirai.breadbot.framework.BreadBotClient; -import com.github.breadmoirai.breadbot.framework.builder.BreadBotClientBuilder; +import com.github.breadmoirai.breadbot.framework.BreadBot; +import com.github.breadmoirai.breadbot.framework.builder.BreadBotBuilder; import com.github.breadmoirai.breadbot.framework.builder.CommandHandleBuilder; import com.github.breadmoirai.breadbot.framework.command.AbstractCommand; import com.github.breadmoirai.breadbot.framework.event.CommandEvent; @@ -57,7 +57,7 @@ public class ClientTest { TestLoggerFactory.getInstance().setPrintLevel(Level.DEBUG); } - private BreadBotClient client; + private BreadBot client; @Test public void basicCommandTest() { @@ -301,8 +301,8 @@ public void onCommand(CommandEvent event) { assertResponse("!test", "am abstract"); } - private void setupBread(Consumer config) { - BreadBotClientBuilder builder = new BreadBotClientBuilder(); + private void setupBread(Consumer config) { + BreadBotBuilder builder = new BreadBotBuilder(); config.accept(builder); client = builder.build(); } diff --git a/src/test/java/com/github/breadmoirai/tests/DefaultTester.java b/src/test/java/com/github/breadmoirai/tests/DefaultTester.java index 63075d23..2d4fc989 100644 --- a/src/test/java/com/github/breadmoirai/tests/DefaultTester.java +++ b/src/test/java/com/github/breadmoirai/tests/DefaultTester.java @@ -16,8 +16,8 @@ package com.github.breadmoirai.tests; -import com.github.breadmoirai.breadbot.framework.BreadBotClient; -import com.github.breadmoirai.breadbot.framework.builder.BreadBotClientBuilder; +import com.github.breadmoirai.breadbot.framework.BreadBot; +import com.github.breadmoirai.breadbot.framework.builder.BreadBotBuilder; import com.github.breadmoirai.breadbot.framework.event.internal.CommandEventInternal; import com.github.breadmoirai.tests.commands.AuthorCommand; import com.github.breadmoirai.tests.commands.EchoCommand; @@ -40,11 +40,11 @@ public class DefaultTester { TestLoggerFactory.getInstance().setPrintLevel(Level.DEBUG); } - private BreadBotClient client; + private BreadBot client; @Test public void matchRegexTest() { - client = new BreadBotClientBuilder().addCommand(EchoCommand::new).build(); + client = new BreadBotBuilder().addCommand(EchoCommand::new).build(); assertResponse("!echo echo", "echo"); assertResponse("!echonum echo", null); assertResponse("!echonum 124", "124"); @@ -52,7 +52,7 @@ public void matchRegexTest() { @Test public void authorTest() { - client = new BreadBotClientBuilder() + client = new BreadBotBuilder() .addCommand(AuthorCommand::new) .build(); assertResponse(MockFactory.UserType.BASIC, "!author", MockFactory.BASIC_NAME); @@ -62,7 +62,7 @@ public void authorTest() { @Test public void adminTest() { - client = new BreadBotClientBuilder() + client = new BreadBotBuilder() .addAdminPlugin() .addCommand(WhoAmICommand::new) .build(); diff --git a/src/test/java/com/github/breadmoirai/tests/ExceptionTester.java b/src/test/java/com/github/breadmoirai/tests/ExceptionTester.java index 226d8ee6..f23e0783 100644 --- a/src/test/java/com/github/breadmoirai/tests/ExceptionTester.java +++ b/src/test/java/com/github/breadmoirai/tests/ExceptionTester.java @@ -16,8 +16,8 @@ package com.github.breadmoirai.tests; -import com.github.breadmoirai.breadbot.framework.BreadBotClient; -import com.github.breadmoirai.breadbot.framework.builder.BreadBotClientBuilder; +import com.github.breadmoirai.breadbot.framework.BreadBot; +import com.github.breadmoirai.breadbot.framework.builder.BreadBotBuilder; import com.github.breadmoirai.breadbot.framework.command.Command; import com.github.breadmoirai.breadbot.framework.command.CommandPreprocessor; import com.github.breadmoirai.breadbot.framework.command.internal.CommandObjectFactory; @@ -55,7 +55,7 @@ public class ExceptionTester { @Test(expected = MissingCommandKeyException.class) public void missingKey() { - new BreadBotClientBuilder() + new BreadBotBuilder() .addCommand(commandEvent -> { }, configurator -> { }) @@ -64,7 +64,7 @@ public void missingKey() { @Test(expected = DuplicateCommandKeyException.class) public void duplicateKey() { - new BreadBotClientBuilder() + new BreadBotBuilder() .addCommand(PingCommand.class) .addCommand(PingCommand::new) .build(); @@ -72,7 +72,7 @@ public void duplicateKey() { @Test(expected = RuntimeException.class) public void commandctorBuild() { - new BreadBotClientBuilder() + new BreadBotBuilder() .addCommand(BadCtorCommand::new) .build(); } @@ -82,7 +82,7 @@ public void commandctorInvoke() { TestLogger testLogger = TestLoggerFactory.getTestLogger(CommandObjectFactory.class); testLogger.setEnabledLevels(Level.ERROR); - BreadBotClient bread = new BreadBotClientBuilder() + BreadBot bread = new BreadBotBuilder() .addCommand(BadCtorCommand.class) .build(); CommandEventInternal mock = mockCommand(bread, "!bad", MockFactory.UserType.BASIC); @@ -102,7 +102,7 @@ public void preprocessorTest() { TestLogger testLogger = TestLoggerFactory.getTestLogger(CommandPreprocessor.class); testLogger.setEnabledLevels(Level.ERROR); - BreadBotClient bread = new BreadBotClientBuilder() + BreadBot bread = new BreadBotBuilder() .createCommand(BadPrepCommand.class) .getClientBuilder().build(); @@ -123,7 +123,7 @@ public void commandRunTest() { TestLogger testLogger = TestLoggerFactory.getTestLogger(Command.class); testLogger.setEnabledLevels(Level.ERROR); - BreadBotClient bread = new BreadBotClientBuilder() + BreadBot bread = new BreadBotBuilder() .createCommand(BadCommand.class) .getClientBuilder().build(); @@ -150,21 +150,21 @@ public void commandRunTest() { @Test(expected = IllegalArgumentException.class) public void nullCommandClassTest() { - new BreadBotClientBuilder() + new BreadBotBuilder() .addCommand((Class) null) .build(); } @Test(expected = IllegalArgumentException.class) public void nullCommandSupplierTest() { - new BreadBotClientBuilder() + new BreadBotBuilder() .addCommand((Supplier) null) .build(); } @Test(expected = IllegalArgumentException.class) public void nullCommandObjectTest() { - new BreadBotClientBuilder() + new BreadBotBuilder() .addCommand((Object) null) .build(); } diff --git a/src/test/java/com/github/breadmoirai/tests/MockFactory.java b/src/test/java/com/github/breadmoirai/tests/MockFactory.java index 9c5efd6f..d7973dc0 100644 --- a/src/test/java/com/github/breadmoirai/tests/MockFactory.java +++ b/src/test/java/com/github/breadmoirai/tests/MockFactory.java @@ -16,7 +16,7 @@ package com.github.breadmoirai.tests; -import com.github.breadmoirai.breadbot.framework.BreadBotClient; +import com.github.breadmoirai.breadbot.framework.BreadBot; import com.github.breadmoirai.breadbot.framework.event.internal.CommandEventFactoryImpl; import com.github.breadmoirai.breadbot.framework.event.internal.CommandEventInternal; import com.github.breadmoirai.breadbot.plugins.prefix.UnmodifiablePrefixPlugin; @@ -54,7 +54,7 @@ public class MockFactory { when(selfMember.getEffectiveName()).thenReturn(SELF_NAME); } - public static CommandEventInternal mockCommand(BreadBotClient client, String input, UserType userType) { + public static CommandEventInternal mockCommand(BreadBot client, String input, UserType userType) { // GenericGuildMessageEvent mockInput = mock(GenericGuildMessageEvent.class); // Guild mockGuild = mock(Guild.class); // when(mockGuild.getIdLong()).thenReturn(0L); diff --git a/src/test/java/com/github/breadmoirai/tests/ParameterTester.java b/src/test/java/com/github/breadmoirai/tests/ParameterTester.java index 274f4bcc..6afd134c 100644 --- a/src/test/java/com/github/breadmoirai/tests/ParameterTester.java +++ b/src/test/java/com/github/breadmoirai/tests/ParameterTester.java @@ -16,8 +16,8 @@ package com.github.breadmoirai.tests; -import com.github.breadmoirai.breadbot.framework.BreadBotClient; -import com.github.breadmoirai.breadbot.framework.builder.BreadBotClientBuilder; +import com.github.breadmoirai.breadbot.framework.BreadBot; +import com.github.breadmoirai.breadbot.framework.builder.BreadBotBuilder; import com.github.breadmoirai.breadbot.framework.event.internal.CommandEventInternal; import com.github.breadmoirai.tests.commands.NameCommand; import com.github.breadmoirai.tests.commands.PingCommand; @@ -39,11 +39,11 @@ public class ParameterTester { TestLoggerFactory.getInstance().setPrintLevel(Level.INFO); } - private BreadBotClient client; + private BreadBot client; @Test public void width1() { - client = new BreadBotClientBuilder() + client = new BreadBotBuilder() .addCommand(SSICommand.class) .build(); assertResponse("!ssi", "null, null, null"); @@ -57,7 +57,7 @@ public void width1() { @Test public void width0() { - client = new BreadBotClientBuilder() + client = new BreadBotBuilder() .addCommand(SSICommand.class, handleBuilder -> handleBuilder.getParameters().forEach(param -> param.setWidth(0))) .build(); assertResponse("!ssi", "null, null, null"); @@ -68,7 +68,7 @@ public void width0() { @Test public void widthNegative() { - client = new BreadBotClientBuilder() + client = new BreadBotBuilder() .addCommand(SSICommand.class, handleBuilder -> handleBuilder.getParameters().forEach(param -> param.setWidth(-1))) .build(); assertResponse("!ssi", "null, null, null"); @@ -79,7 +79,7 @@ public void widthNegative() { @Test public void widthPositive() { - client = new BreadBotClientBuilder() + client = new BreadBotBuilder() .addCommand(SSICommand.class, handleBuilder -> handleBuilder.getParameters().forEach(param -> param.setWidth(2))) .build(); assertResponse("!ssi", "null, null, null"); @@ -90,7 +90,7 @@ public void widthPositive() { @Test public void indexPositive() { - client = new BreadBotClientBuilder() + client = new BreadBotBuilder() .addCommand(SSICommand.class, command -> command .configureParameter(0, param -> param.setIndex(3)) .configureParameter(1, param -> param.setIndex(2)) @@ -103,7 +103,7 @@ public void indexPositive() { @Test public void indexNegative() { - client = new BreadBotClientBuilder() + client = new BreadBotBuilder() .addCommand(SSICommand.class, command -> command .configureParameter(0, param -> param.setIndex(-1)) .configureParameter(1, param -> param.setIndex(-2)) @@ -117,7 +117,7 @@ public void indexNegative() { @Test public void parameterPropertyTest() { - client = new BreadBotClientBuilder().addCommand(NameCommand.class).build(); + client = new BreadBotBuilder().addCommand(NameCommand.class).build(); assertResponse("!name a b c", "a b c"); assertResponse("!first a b c", "a"); assertResponse("!last a b c", "b c"); @@ -125,7 +125,7 @@ public void parameterPropertyTest() { @Test public void subParameterPropertyTest() { - client = new BreadBotClientBuilder() + client = new BreadBotBuilder() .createCommand(PingCommand.class).addCommand(NameCommand.class) .getClientBuilder().build(); assertResponse("!ping name a b c", "a b c"); @@ -135,7 +135,7 @@ public void subParameterPropertyTest() { @Test public void wikiTest() { - client = new BreadBotClientBuilder() + client = new BreadBotBuilder() .addCommand(WikiParameterCommand.class) .build(); assertResponse("!ex hello 1", "lint=1, third=null, start=hello");