Add changelog

This commit is contained in:
Alexander Söderberg 2021-07-07 19:21:56 +01:00 committed by Jason
parent 7bb5e63dc7
commit 5934c2fd3b
6 changed files with 20 additions and 1 deletions

View file

@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.6.0]
### Added
- Kotlin: Support for suspending command functions using `AnnotationParser<C>.installCoroutineSupport()`
### Changed
- Added `executeFuture` to `CommandExecutionHandler` which is now used internally. By default, this delegates to the old
`execute` method
## [1.5.0] ## [1.5.0]
### Added ### Added

View file

@ -190,6 +190,7 @@ public final class AnnotationParser<C> {
* Returns the command manager that was used to create this parser * Returns the command manager that was used to create this parser
* *
* @return Command manager * @return Command manager
* @since 1.6.0
*/ */
public @NonNull CommandManager<C> manager() { public @NonNull CommandManager<C> manager() {
return this.manager; return this.manager;
@ -201,6 +202,7 @@ public final class AnnotationParser<C> {
* *
* @param predicate The predicate that decides whether or not to apply the custom execution handler to the given method * @param predicate The predicate that decides whether or not to apply the custom execution handler to the given method
* @param function The function that produces the command execution handler * @param function The function that produces the command execution handler
* @since 1.6.0
*/ */
public void registerCommandExecutionMethodFactory( public void registerCommandExecutionMethodFactory(
final @NonNull Predicate<@NonNull Method> predicate, final @NonNull Predicate<@NonNull Method> predicate,

View file

@ -44,6 +44,7 @@ import java.util.Optional;
* A command execution handler that invokes a method. * A command execution handler that invokes a method.
* *
* @param <C> Command sender type. * @param <C> Command sender type.
* @since 1.6.0 (Was made public in 1.6.0)
*/ */
public class MethodCommandExecutionHandler<C> implements CommandExecutionHandler<C> { public class MethodCommandExecutionHandler<C> implements CommandExecutionHandler<C> {

View file

@ -914,6 +914,7 @@ public abstract class CommandManager<C> {
* Returns the command execution coordinator used in this manager * Returns the command execution coordinator used in this manager
* *
* @return Command execution coordinator * @return Command execution coordinator
* @since 1.6.0
*/ */
public @NonNull CommandExecutionCoordinator<C> commandExecutionCoordinator() { public @NonNull CommandExecutionCoordinator<C> commandExecutionCoordinator() {
return this.commandExecutionCoordinator; return this.commandExecutionCoordinator;

View file

@ -52,6 +52,7 @@ public interface CommandExecutionHandler<C> {
* *
* @param commandContext Command context * @param commandContext Command context
* @return future that completes when the command has finished execution * @return future that completes when the command has finished execution
* @since 1.6.0
*/ */
default CompletableFuture<@Nullable Object> executeFuture(@NonNull CommandContext<C> commandContext) { default CompletableFuture<@Nullable Object> executeFuture(@NonNull CommandContext<C> commandContext) {
final CompletableFuture<Object> future = new CompletableFuture<>(); final CompletableFuture<Object> future = new CompletableFuture<>();
@ -83,6 +84,7 @@ public interface CommandExecutionHandler<C> {
* by a command sender * by a command sender
* *
* @param <C> Command sender type * @param <C> Command sender type
* @since 1.6.0
*/ */
@FunctionalInterface @FunctionalInterface
interface FutureCommandExecutionHandler<C> extends CommandExecutionHandler<C> { interface FutureCommandExecutionHandler<C> extends CommandExecutionHandler<C> {

View file

@ -14,7 +14,11 @@ import kotlin.reflect.jvm.kotlinFunction
import kotlinx.coroutines.* import kotlinx.coroutines.*
import kotlinx.coroutines.future.asCompletableFuture import kotlinx.coroutines.future.asCompletableFuture
/** Adds coroutine support to the [AnnotationParser]. */ /**
* Adds coroutine support to the [AnnotationParser].
*
* @since 1.6.0
*/
public fun <C> AnnotationParser<C>.installCoroutineSupport( public fun <C> AnnotationParser<C>.installCoroutineSupport(
scope: CoroutineScope = GlobalScope, scope: CoroutineScope = GlobalScope,
context: CoroutineContext = EmptyCoroutineContext context: CoroutineContext = EmptyCoroutineContext