From 55505cf5b16ad8f8a073f2219649e0dcb4c9ad4b Mon Sep 17 00:00:00 2001 From: Schlaumeier5 Date: Wed, 21 Jan 2026 20:46:26 +0100 Subject: [PATCH 1/2] Removed unused imports --- .../votes/rewards/matchers/ChanceFractionalRewardMatcher.java | 1 - .../votes/rewards/matchers/PermissionRewardMatcher.java | 1 - .../superbvote/votes/rewards/matchers/ScriptRewardMatcher.java | 2 -- .../superbvote/votes/rewards/matchers/ServiceRewardMatcher.java | 1 - 4 files changed, 5 deletions(-) diff --git a/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/ChanceFractionalRewardMatcher.java b/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/ChanceFractionalRewardMatcher.java index 8f106b7..fe4b218 100644 --- a/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/ChanceFractionalRewardMatcher.java +++ b/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/ChanceFractionalRewardMatcher.java @@ -4,7 +4,6 @@ import io.minimum.minecraft.superbvote.util.PlayerVotes; import io.minimum.minecraft.superbvote.votes.Vote; import lombok.RequiredArgsConstructor; -import org.bukkit.configuration.ConfigurationSection; import java.util.Optional; import java.util.Random; diff --git a/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/PermissionRewardMatcher.java b/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/PermissionRewardMatcher.java index 424011a..4a6f682 100644 --- a/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/PermissionRewardMatcher.java +++ b/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/PermissionRewardMatcher.java @@ -1,6 +1,5 @@ package io.minimum.minecraft.superbvote.votes.rewards.matchers; -import com.google.common.base.Preconditions; import io.minimum.minecraft.superbvote.util.PlayerVotes; import io.minimum.minecraft.superbvote.votes.Vote; import lombok.RequiredArgsConstructor; diff --git a/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/ScriptRewardMatcher.java b/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/ScriptRewardMatcher.java index 8f8015b..04d578c 100644 --- a/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/ScriptRewardMatcher.java +++ b/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/ScriptRewardMatcher.java @@ -5,8 +5,6 @@ import io.minimum.minecraft.superbvote.votes.Vote; import lombok.NonNull; import lombok.Value; -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; import javax.script.Invocable; import javax.script.ScriptEngine; diff --git a/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/ServiceRewardMatcher.java b/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/ServiceRewardMatcher.java index 8047d52..6c4f391 100644 --- a/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/ServiceRewardMatcher.java +++ b/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/ServiceRewardMatcher.java @@ -1,7 +1,6 @@ package io.minimum.minecraft.superbvote.votes.rewards.matchers; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; import io.minimum.minecraft.superbvote.util.PlayerVotes; import io.minimum.minecraft.superbvote.votes.Vote; import lombok.ToString; From d2f5833f500bcbe94cf364117d543b7d6cddfffc Mon Sep 17 00:00:00 2001 From: Schlaumeier5 Date: Wed, 21 Jan 2026 20:56:06 +0100 Subject: [PATCH 2/2] Now using apache commons-text for Levenshtein distance instead of deprecated method - added commons-text as dependency - changed RewardMatchers.java to use org.apache.commons.text.similarity.LevenshteinDistance instead of the deprecated method org.apache.commons.lang3.StringUtils.getLevenshteinDistance() --- pom.xml | 5 +++++ .../superbvote/votes/rewards/matchers/RewardMatchers.java | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 9572b30..77a2fef 100644 --- a/pom.xml +++ b/pom.xml @@ -71,6 +71,11 @@ 1.7.1 provided + + org.apache.commons + commons-text + 1.15.0 + diff --git a/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/RewardMatchers.java b/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/RewardMatchers.java index 4f52fdd..b354dc6 100644 --- a/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/RewardMatchers.java +++ b/src/main/java/io/minimum/minecraft/superbvote/votes/rewards/matchers/RewardMatchers.java @@ -5,7 +5,7 @@ import com.google.common.collect.ImmutableSet; import io.minimum.minecraft.superbvote.SuperbVote; import net.milkbowl.vault.permission.Permission; -import org.apache.commons.lang3.StringUtils; +import org.apache.commons.text.similarity.LevenshteinDistance; import org.bukkit.Bukkit; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.plugin.RegisteredServiceProvider; @@ -45,7 +45,7 @@ public class RewardMatchers { private static List closestMatch(String string) { List matched = new ArrayList<>(); for (String availableMatcher : AVAILABLE_MATCHERS) { - if (StringUtils.getLevenshteinDistance(string, availableMatcher) <= 2) { + if (LevenshteinDistance.getDefaultInstance().apply(string, availableMatcher) <= 2) { matched.add(availableMatcher); } }