From 7694c397b0db2682c7f79a71cce6350caf1b7fa6 Mon Sep 17 00:00:00 2001 From: fdai7430 Date: Sat, 28 Jan 2023 14:33:46 +0100 Subject: [PATCH] refactoring: Pulled getting enemies from location into its own function --- .../java/org/bitbiome/commands/UseCommand.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/UseCommand.java b/src/main/java/org/bitbiome/commands/UseCommand.java index 4bfe3c5..52ac913 100644 --- a/src/main/java/org/bitbiome/commands/UseCommand.java +++ b/src/main/java/org/bitbiome/commands/UseCommand.java @@ -11,12 +11,7 @@ ArrayList enemies = new ArrayList(); @Override public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine engine) { - ArrayList allMobs = engine.getPlayer().getLocation().getMobList(); - for(int i = 0; i enemies = new ArrayList(); target.setFriendly(false); return "You used " + item.getName() + " on " + target.getName(); } + + private void getEnemies(ArrayList allMobs) { + for(int i = 0; i