From 1033a02a2972c0ae1c948e6392166dcfec21beef Mon Sep 17 00:00:00 2001 From: fdai7430 Date: Mon, 16 Jan 2023 10:43:37 +0100 Subject: [PATCH] refactoring: Pulled the actual using of the item into its own function --- src/main/java/org/bitbiome/commands/UseCommand.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/UseCommand.java b/src/main/java/org/bitbiome/commands/UseCommand.java index 135b669..041d4e4 100644 --- a/src/main/java/org/bitbiome/commands/UseCommand.java +++ b/src/main/java/org/bitbiome/commands/UseCommand.java @@ -10,9 +10,11 @@ public class UseCommand implements CommandAPI { private String getUseMessage(String msg) { String message[] = msg.split(" on "); - String returnString = "You used " + msg; - if(message.length == 1) - returnString+=" on yourself"; + String returnString = useItem(message[0], message[1]); return returnString; } + + private String useItem(String item, String target) { + return "You used " + item + " on " + target; + } } \ No newline at end of file