From afe45abd1b920d5388b514592256a1d0f75ad4c0 Mon Sep 17 00:00:00 2001 From: KandiPanda <43508599+KandiPanda@users.noreply.github.com> Date: Fri, 12 Jun 2020 01:52:18 -0500 Subject: [PATCH] Update PickupHandler.java Removed redundant EntityTameable check from within code already covered by another EntityTameable check (would always be "true" anyways). Removed redundant EntityTameable check and contents from within the "else" of same outer check (else means it's already failed, and will never succeed this check or run the code within it anyways). --- .../carryon/common/handler/PickupHandler.java | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/main/java/tschipp/carryon/common/handler/PickupHandler.java b/src/main/java/tschipp/carryon/common/handler/PickupHandler.java index 4ef119e..d62a368 100644 --- a/src/main/java/tschipp/carryon/common/handler/PickupHandler.java +++ b/src/main/java/tschipp/carryon/common/handler/PickupHandler.java @@ -231,14 +231,9 @@ public class PickupHandler double distance = pos.distanceSqToCenter(player.posX, player.posY + 0.5, player.posZ); if (distance < Math.pow(CarryOnConfig.settings.maxDistance, 2)) { - if (toPickUp instanceof EntityTameable) - { - EntityTameable tame = (EntityTameable) toPickUp; - UUID owner = tame.getOwnerId(); - UUID playerID = player.getUUID(player.getGameProfile()); - if (owner != null && !owner.equals(playerID)) - return false; - } + UUID playerID = player.getUUID(player.getGameProfile()); + if (OwnerCheck != null && !OwnerCheck.equals(playerID)) + return false; if (CustomPickupOverrideHandler.hasSpecialPickupConditions(toPickUp)) { @@ -299,15 +294,6 @@ public class PickupHandler double distance = pos.distanceSqToCenter(player.posX, player.posY + 0.5, player.posZ); if (distance < Math.pow(CarryOnConfig.settings.maxDistance, 2)) { - if (toPickUp instanceof EntityTameable) - { - EntityTameable tame = (EntityTameable) toPickUp; - UUID owner = tame.getOwnerId(); - UUID playerID = player.getUUID(player.getGameProfile()); - if (owner != null && !owner.equals(playerID)) - return false; - } - if (CustomPickupOverrideHandler.hasSpecialPickupConditions(toPickUp)) { try