From 1b2d72a078c03b1c89d95d52c4d0191c9bcef151 Mon Sep 17 00:00:00 2001 From: fdai7430 Date: Mon, 30 Jan 2023 10:44:15 +0100 Subject: [PATCH] Items and target should not be provided as arguments by player but instead be requested --- src/main/java/org/bitbiome/commands/UseCommand.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bitbiome/commands/UseCommand.java b/src/main/java/org/bitbiome/commands/UseCommand.java index 633fc22..c0e5444 100644 --- a/src/main/java/org/bitbiome/commands/UseCommand.java +++ b/src/main/java/org/bitbiome/commands/UseCommand.java @@ -14,7 +14,14 @@ private boolean combat = false; public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine engine) { Player player = engine.getPlayer(); getEnemies(player.getLocation().getMobList()); - System.out.println(getUseMessage(message.split(" ", 2)[1], engine)); + System.out.println("Which item would you like to use?"); + String item = scanner.nextLine(); + System.out.println("On who? (leave blank for self)"); + String target = scanner.nextLine(); + if(target.equals("")) + System.out.println(getUseMessage(item, engine)); + else + System.out.println(getUseMessage(item + " on " + target, engine)); while(enemies.size() > 0 && combat) { if(player.getHp() <= 0) System.exit(0);