From 6e9f9b3ef0143376036861a2eccf7bedb9c5005b Mon Sep 17 00:00:00 2001 From: BONNe Date: Thu, 13 Apr 2023 18:53:32 +0300 Subject: [PATCH] Remove dependency to org.apache.commons Replace org.apache.commons.lang.ArrayUtils to a default Java implementation. --- .../world/bentobox/biomes/panels/ConversationUtils.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/world/bentobox/biomes/panels/ConversationUtils.java b/src/main/java/world/bentobox/biomes/panels/ConversationUtils.java index ec67e8b..f9fea60 100644 --- a/src/main/java/world/bentobox/biomes/panels/ConversationUtils.java +++ b/src/main/java/world/bentobox/biomes/panels/ConversationUtils.java @@ -7,12 +7,12 @@ package world.bentobox.biomes.panels; -import org.apache.commons.lang.ArrayUtils; import org.bukkit.ChatColor; import org.bukkit.conversations.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.function.Consumer; import java.util.function.Function; @@ -68,7 +68,7 @@ protected boolean isInputValid(@NotNull ConversationContext context, @NotNull St // Split and check if they exist in valid entries. String[] accepted = validEntry.toLowerCase().replaceAll("\\s", "").split(","); - return ArrayUtils.contains(accepted, input.toLowerCase()); + return Arrays.asList(accepted).contains(input.toLowerCase()); } @@ -84,7 +84,7 @@ protected Prompt acceptValidatedInput(@NotNull ConversationContext context, @Not { String validEntry = user.getTranslation(Constants.CONVERSATIONS + "confirm-string").toLowerCase(); - if (ArrayUtils.contains(validEntry.replaceAll("\\s", "").split(","), input.toLowerCase())) + if (Arrays.asList(validEntry.replaceAll("\\s", "").split(",")).contains(input.toLowerCase())) { // Add answer to consumer. consumer.accept(true); @@ -441,7 +441,7 @@ public Prompt acceptInput(@NotNull ConversationContext context, @Nullable String toLowerCase().replaceAll("\\s", ""). split(","); - if (input != null && ArrayUtils.contains(exit, input.toLowerCase())) + if (input != null && Arrays.asList(exit).contains(input.toLowerCase())) { return messagePrompt; }