From 1129a8032994740fa3bd9cf0f7efb9d3d917a92c Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 17 Mar 2017 17:41:58 +1100 Subject: [PATCH] Fixes #1510 --- .../java/com/intellectualcrafters/plot/PS.java | 4 ++++ .../plot/commands/Auto.java | 18 ++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/PS.java b/Core/src/main/java/com/intellectualcrafters/plot/PS.java index b4addb769..c3d2db9f5 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/PS.java @@ -353,6 +353,10 @@ public class PS{ return logger; } + public PlotAreaManager getPlotAreaManager() { + return manager; + } + /** * Set the Logger. * @see DelegateLogger diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java index 75de9ef50..78a1e57a3 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java @@ -1,5 +1,6 @@ package com.intellectualcrafters.plot.commands; +import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.object.Expression; @@ -56,8 +57,21 @@ public class Auto extends SubCommand { public boolean onCommand(PlotPlayer player, String[] args) { PlotArea plotarea = player.getApplicablePlotArea(); if (plotarea == null) { - MainUtil.sendMessage(player, C.NOT_IN_PLOT_WORLD); - return false; + if (EconHandler.manager != null) { + for (PlotArea area : PS.get().getPlotAreaManager().getAllPlotAreas()) { + if (EconHandler.manager.hasPermission(area.worldname, player.getName(), "plots.auto")) { + if (plotarea != null) { + plotarea = null; + break; + } + plotarea = area; + } + } + } + if (plotarea == null) { + MainUtil.sendMessage(player, C.NOT_IN_PLOT_WORLD); + return false; + } } int size_x = 1; int size_z = 1;