diff --git a/pom.xml b/pom.xml index 235db10..548c0c6 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.github.ygimenez Pagination-Utils - 3.0.7 + 3.0.8 jar Pagination Utils @@ -33,7 +33,7 @@ https://github.com/ygimenez/Pagination-Utils scm:git:git@github.com:ygimenez/Pagination-Utils.git scm:git:git@github.com:ygimenez/Pagination-Utils.git - Pagination-Utils-3.0.7 + Pagination-Utils-3.0.8 diff --git a/src/main/java/com/github/ygimenez/method/Pages.java b/src/main/java/com/github/ygimenez/method/Pages.java index 407b034..bf6f264 100644 --- a/src/main/java/com/github/ygimenez/method/Pages.java +++ b/src/main/java/com/github/ygimenez/method/Pages.java @@ -808,7 +808,7 @@ public void acceptThrows(@Nonnull User u, @Nonnull PaginationEventWrapper wrappe if (emt == CANCEL) { finalizeEvent(m, success); return; - } else if (emoji != null && Objects.equals(emoji, currCat)) { + } else if (emoji != null && !Objects.equals(emoji, currCat)) { Page pg = cats.get(emoji); if (pg != null) { if (currCat != null && pg instanceof InteractPage) { diff --git a/src/main/java/com/github/ygimenez/model/PaginatorBuilder.java b/src/main/java/com/github/ygimenez/model/PaginatorBuilder.java index 8dcf8bc..6698b5b 100644 --- a/src/main/java/com/github/ygimenez/model/PaginatorBuilder.java +++ b/src/main/java/com/github/ygimenez/model/PaginatorBuilder.java @@ -18,7 +18,7 @@ /** * {@link Paginator}'s builder, this class allows you to customize Pagination-Utils' behavior * as you like.
- * If you want a quick setup, use {@link #createSimplePaginator(Object)}. + * If you want a quick setup, use {@link #createSimplePaginator(JDA)} or {@link #createSimplePaginator(ShardManager)}. */ public class PaginatorBuilder { private final Paginator paginator; @@ -45,11 +45,23 @@ public static PaginatorBuilder createPaginator() { /** * Creates a new {@link Paginator} instance using default settings. * - * @param handler The handler that'll be used for event processing - * (must be either {@link JDA} or {@link ShardManager}). + * @param handler The {@link JDA} instance that'll be used for event processing. * @return The {@link PaginatorBuilder} instance for chaining convenience. */ - public static Paginator createSimplePaginator(@Nonnull Object handler) { + public static Paginator createSimplePaginator(@Nonnull JDA handler) { + Paginator p = new Paginator(handler); + p.finishEmotes(); + + return p; + } + + /** + * Creates a new {@link Paginator} instance using default settings. + * + * @param handler The {@link ShardManager} instance that'll be used for event processing. + * @return The {@link PaginatorBuilder} instance for chaining convenience. + */ + public static Paginator createSimplePaginator(@Nonnull ShardManager handler) { Paginator p = new Paginator(handler); p.finishEmotes(); @@ -68,16 +80,21 @@ public Object getHandler() { /** * Sets the handler used for event processing. * - * @param handler The handler that'll be used for event processing - * (must be either {@link JDA} or {@link ShardManager}). + * @param handler The {@link JDA} instance that'll be used for event processing. * @return The {@link PaginatorBuilder} instance for chaining convenience. - * @throws InvalidHandlerException If the supplied handler is not a {@link JDA} or {@link ShardManager} - * object. */ - public PaginatorBuilder setHandler(@Nonnull Object handler) throws InvalidHandlerException { - if (!(handler instanceof JDA) && !(handler instanceof ShardManager)) - throw new InvalidHandlerException(); + public PaginatorBuilder setHandler(@Nonnull JDA handler) { + paginator.setHandler(handler); + return this; + } + /** + * Sets the handler used for event processing. + * + * @param handler The {@link ShardManager} instance that'll be used for event processing. + * @return The {@link PaginatorBuilder} instance for chaining convenience. + */ + public PaginatorBuilder setHandler(@Nonnull ShardManager handler) { paginator.setHandler(handler); return this; }