From a3f0fcf5aa2c614f174b2efee10a75840eae5e8d Mon Sep 17 00:00:00 2001 From: Gabriel Tofvesson Date: Wed, 30 Jun 2021 00:04:05 +0200 Subject: [PATCH] Implement /search result ordering by distance --- src/dev/w1zzrd/invtweaks/command/SearchCommandExecutor.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dev/w1zzrd/invtweaks/command/SearchCommandExecutor.java b/src/dev/w1zzrd/invtweaks/command/SearchCommandExecutor.java index fbf9391..b2a77cd 100644 --- a/src/dev/w1zzrd/invtweaks/command/SearchCommandExecutor.java +++ b/src/dev/w1zzrd/invtweaks/command/SearchCommandExecutor.java @@ -15,6 +15,7 @@ import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.*; +import java.util.Comparator; import java.util.logging.Logger; import static dev.w1zzrd.invtweaks.listener.TabCompletionListener.getMaterialMatching; @@ -49,11 +50,12 @@ public class SearchCommandExecutor extends ConfigurableCommandExecutor matches = searchChunks( - player.getLocation().getChunk(), + playerLocation.getChunk(), config.getSearchRadiusX(), Material.CHEST, Material.TRAPPED_CHEST, Material.SHULKER_BOX ); @@ -62,6 +64,8 @@ public class SearchCommandExecutor extends ConfigurableCommandExecutor state.getLocation().distanceSquared(playerLocation))); + final InventoryHolder result; FIND_RESULT: