From 67c1375b4ffc95e297d1f1dc243f81482c22e83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Gla=C3=9F?= Date: Fri, 15 Apr 2022 22:31:15 +0200 Subject: [PATCH] [Improved] Algorithm for Play Finding --- .../command/commands/PlayCommand.java | 2 +- .../yoshibot/utils/StatusProviderFactory.java | 1 - rsc/mcservers.json | 42 +++++++++---------- 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/app/src/main/java/de/yannicpunktdee/yoshibot/command/commands/PlayCommand.java b/app/src/main/java/de/yannicpunktdee/yoshibot/command/commands/PlayCommand.java index 72f16de..8736994 100644 --- a/app/src/main/java/de/yannicpunktdee/yoshibot/command/commands/PlayCommand.java +++ b/app/src/main/java/de/yannicpunktdee/yoshibot/command/commands/PlayCommand.java @@ -114,7 +114,7 @@ public class PlayCommand extends YoshiCommand { private String getBestMatch(String word, List choices) { Optional match = choices.parallelStream().filter(word::equals).findAny(); - return match.orElse(choices.parallelStream().max( + return match.orElse(choices.parallelStream().min( Comparator.comparingDouble(file -> new JaccardDistance().apply(word, file))).orElse(null)); } diff --git a/app/src/main/java/de/yannicpunktdee/yoshibot/utils/StatusProviderFactory.java b/app/src/main/java/de/yannicpunktdee/yoshibot/utils/StatusProviderFactory.java index e214954..87269f3 100644 --- a/app/src/main/java/de/yannicpunktdee/yoshibot/utils/StatusProviderFactory.java +++ b/app/src/main/java/de/yannicpunktdee/yoshibot/utils/StatusProviderFactory.java @@ -8,7 +8,6 @@ import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.entities.TextChannel; import net.dv8tion.jda.api.exceptions.ErrorResponseException; -import org.apache.commons.io.FileUtils; import org.json.JSONArray; import org.json.JSONObject; diff --git a/rsc/mcservers.json b/rsc/mcservers.json index 8440f20..09e491d 100644 --- a/rsc/mcservers.json +++ b/rsc/mcservers.json @@ -1,22 +1,20 @@ -{ - "servers": [ - { - "ip": "85.214.148.23:25568", - "name": "MCMuffing™®㋏ Inc.", - "message": 960979835361046558, - "timestamp": "21:16:35 Di, 05.04.2022" - }, - { - "ip": "85.214.148.23:25566", - "name": "Enigmatica 6: Expert 1.0.0", - "message": 960970269051191386, - "timestamp": "20:15:36 Di, 05.04.2022" - }, - { - "ip": "85.214.148.23:25570", - "name": "Medieval Minecraft 1.16.5 v52", - "message": 960970288194002954, - "timestamp": "20:15:36 Di, 05.04.2022" - } - ] -} \ No newline at end of file +{"servers": [ + { + "ip": "85.214.148.23:25568", + "name": "MCMuffing™®㋏ Inc.", + "message": 960983446350594049, + "timestamp": "13:43:35 Fr., 15.04.2022" + }, + { + "ip": "85.214.148.23:25566", + "name": "Enigmatica 6: Expert 1.0.0", + "message": 960983448410013737, + "timestamp": "21:25:08 Di., 05.04.2022" + }, + { + "ip": "85.214.148.23:25570", + "name": "Medieval Minecraft 1.16.5 v52", + "message": 960983449961922600, + "timestamp": "11:30:09 So., 10.04.2022" + } +]} \ No newline at end of file