@Override public boolean onCommand(final PlotPlayer plr, final String[] args) { final Location ploc = plr.getLocation(); if (!PS.get().isPlotWorld(ploc.getWorld())) { MainUtil.sendMessage(plr, C.NOT_IN_PLOT_WORLD); return false; } PlotId id = PlotId.fromString(args[0]); if (id == null) { if (StringMan.isEqualIgnoreCaseToAny(args[0], "near", "nearest")) { Plot closest = null; int distance = Integer.MAX_VALUE; for (final Plot plot : PS.get().getPlotsInWorld(ploc.getWorld())) { final double current = plot.getBottomAbs().getEuclideanDistanceSquared(ploc); if (current < distance) { distance = (int) current; closest = plot; } } id = closest.getId(); } else { MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID); return false; } } final Location loc = MainUtil.getPlotHome(ploc.getWorld(), id); plr.setCompassTarget(loc); MainUtil.sendMessage(plr, C.COMPASS_TARGET); return true; }