Skip to content

Commit

Permalink
reply format
Browse files Browse the repository at this point in the history
  • Loading branch information
ffauzan committed Jun 13, 2022
1 parent 87ceb1d commit 6ab3c43
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/main/java/uk/haku/idlook/commands/LookCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,19 @@ public final class LookCommand implements CommandHandler {

Collections.sort(resultList);

sendResult(sender, resultList);
sendResult(sender, resultList, lookQuery);
}


public void sendResult(Player player, List<QueryResult> lookResult) {
public void sendResult(Player player, List<QueryResult> lookResult, String query) {
if (lookResult.size() == 0) {
CommandHandler.sendMessage(player, "Cannot find anything, try different keyword");
return;
} else if (lookResult.size() > resultLimit) {
lookResult = lookResult.subList(0, resultLimit);
}

CommandHandler.sendMessage(player, "Result for: " + query);
lookResult.forEach((data) -> {
String name = data.Name;
String itemType = data.ItemType;
Expand Down Expand Up @@ -118,7 +119,7 @@ public void lookForAvatar(String query, ArrayList<QueryResult> lookResult) {
return;
}


public void lookForItem(String query, ArrayList<QueryResult> lookResult) {
// Item
itemMap.forEach((id, data) -> {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/uk/haku/idlook/objects/PluginConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
public final class PluginConfig {
public int scoreTreshold = 40;
public int resultLimit = 5;
public int resultLimit = 3;

/**
* When saved with {@link Gson#toJson(Object)}, it produces:
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"scoreTreshold": 40,
"resultLimit": 5
"resultLimit": 3
}
2 changes: 1 addition & 1 deletion src/main/resources/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "IdLookPlugin",
"description": "The Grasscutter example plugin, which uses Maven.",
"description": "IdLookPlugin",
"version": "1.0",
"authors": [ "FF" ],

Expand Down

0 comments on commit 6ab3c43

Please sign in to comment.