From 2d13de8429a279af1cede5b3c451e905781f98bd Mon Sep 17 00:00:00 2001 From: Juliakn66 <117075450+Juliakn66@users.noreply.github.com> Date: Fri, 3 Feb 2023 15:33:48 +0100 Subject: [PATCH] refactoring: created new method getRandomItem() --- .../bitbiome/commands/LookaroundCommand.java | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/LookaroundCommand.java b/src/main/java/org/bitbiome/commands/LookaroundCommand.java index ce18dda..49133ab 100644 --- a/src/main/java/org/bitbiome/commands/LookaroundCommand.java +++ b/src/main/java/org/bitbiome/commands/LookaroundCommand.java @@ -33,27 +33,8 @@ public class LookaroundCommand implements CommandAPI{ foundItems.removeAll(foundItems); ArrayList foundMobs = location.getMobList(); foundMobs.removeAll(foundMobs); + foundItems = getRandomItem(randomNumberItems, random, items, foundItems); - for (int i=0; i getRandomItem(int randomNumberItems, Random random, JSONArray items, ArrayList foundItems ) { + for (int i=0; i