Browse Source

[Improved] Algorithm for Play Finding

master
Paul Glaß 3 years ago
parent
commit
67c1375b4f
3 changed files with 21 additions and 24 deletions
  1. +1
    -1
      app/src/main/java/de/yannicpunktdee/yoshibot/command/commands/PlayCommand.java
  2. +0
    -1
      app/src/main/java/de/yannicpunktdee/yoshibot/utils/StatusProviderFactory.java
  3. +20
    -22
      rsc/mcservers.json

+ 1
- 1
app/src/main/java/de/yannicpunktdee/yoshibot/command/commands/PlayCommand.java View File

@ -114,7 +114,7 @@ public class PlayCommand extends YoshiCommand {
private String getBestMatch(String word, List<String> choices) { private String getBestMatch(String word, List<String> choices) {
Optional<String> match = choices.parallelStream().filter(word::equals).findAny(); Optional<String> 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)); Comparator.comparingDouble(file -> new JaccardDistance().apply(word, file))).orElse(null));
} }


+ 0
- 1
app/src/main/java/de/yannicpunktdee/yoshibot/utils/StatusProviderFactory.java View File

@ -8,7 +8,6 @@ import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.entities.TextChannel; import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.exceptions.ErrorResponseException; import net.dv8tion.jda.api.exceptions.ErrorResponseException;
import org.apache.commons.io.FileUtils;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;


+ 20
- 22
rsc/mcservers.json View File

@ -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"
}
]
}
{"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"
}
]}

Loading…
Cancel
Save