mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-27 20:57:35 +01:00
Added string utilities class, fixed some imports
This commit is contained in:
parent
eeec8ca228
commit
ab8eee3be9
@ -1,10 +1,10 @@
|
||||
package fr.xephi.authme.command.help;
|
||||
|
||||
import com.timvisee.dungeonmaze.Core;
|
||||
import fr.xephi.authme.commands.CommandArgumentDescription;
|
||||
import fr.xephi.authme.commands.CommandDescription;
|
||||
import fr.xephi.authme.commands.CommandParts;
|
||||
import fr.xephi.authme.commands.CommandPermissions;
|
||||
import fr.xephi.authme.command.CommandArgumentDescription;
|
||||
import fr.xephi.authme.command.CommandDescription;
|
||||
import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.CommandPermissions;
|
||||
import com.timvisee.dungeonmaze.util.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
19
src/main/java/fr/xephi/authme/util/StringUtils.java
Normal file
19
src/main/java/fr/xephi/authme/util/StringUtils.java
Normal file
@ -0,0 +1,19 @@
|
||||
package fr.xephi.authme.util;
|
||||
|
||||
import net.ricecode.similarity.LevenshteinDistanceStrategy;
|
||||
import net.ricecode.similarity.StringSimilarityService;
|
||||
import net.ricecode.similarity.StringSimilarityServiceImpl;
|
||||
|
||||
public class StringUtils {
|
||||
|
||||
public static double getDifference(String first, String second) {
|
||||
if(first == null || second == null)
|
||||
return 1.0;
|
||||
|
||||
StringSimilarityService service = new StringSimilarityServiceImpl(new LevenshteinDistanceStrategy());
|
||||
|
||||
double score = service.score(first, second);
|
||||
|
||||
return Math.abs(score - 1.0);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user