diff --git a/src/main/java/org/bitbiome/commands/UseCommand.java b/src/main/java/org/bitbiome/commands/UseCommand.java index a827597..ca3f582 100644 --- a/src/main/java/org/bitbiome/commands/UseCommand.java +++ b/src/main/java/org/bitbiome/commands/UseCommand.java @@ -2,6 +2,9 @@ package org.bitbiome.commands; import java.util.Scanner; +import org.bitbiome.classes.JsonParser; +import org.json.*; + public class UseCommand implements CommandAPI { @Override public void performCommand(Scanner scanner, boolean isRunning, String message) { @@ -17,4 +20,14 @@ public class UseCommand implements CommandAPI { private String useItem(String item, String target) { return "You used " + item + " on " + target; } + + private JSONObject getItem(String item) { + JSONArray inventory = JsonParser.getJSONObject("playerconfig.json").getJSONArray("inventory"); + for(int i = 0; i < inventory.length(); i++) { + JSONObject currentItem = inventory.getJSONObject(i); + if(currentItem.getString("name").equals(item)) + return currentItem; + } + return null; + } } \ No newline at end of file