From 5a95b338787fdfcb42c4beb992ba7afd268c3767 Mon Sep 17 00:00:00 2001 From: fdai7430 Date: Mon, 16 Jan 2023 11:05:40 +0100 Subject: [PATCH] Created function for getting name of item from command argument --- src/main/java/org/bitbiome/commands/UseCommand.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/UseCommand.java b/src/main/java/org/bitbiome/commands/UseCommand.java index 59f951f..69da5bd 100644 --- a/src/main/java/org/bitbiome/commands/UseCommand.java +++ b/src/main/java/org/bitbiome/commands/UseCommand.java @@ -9,11 +9,16 @@ public class UseCommand implements CommandAPI { } private String getUseMessage(String msg) { - String message[] = msg.split(" on "); - return useItem(message[0], message[1]); + String item = getItemName(msg); + String target = msg.replaceFirst(item + " on ", ""); + return useItem(item, target); } private String useItem(String item, String target) { return "You used " + item + " on " + target; } + + private String getItemName(String msg) { + return ""; + } } \ No newline at end of file