From 3c110bb125ca9fb4a719e37174bbdf360576d927 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 18 Apr 2017 22:54:51 +1000 Subject: [PATCH] Fixes #1585 --- .../plot/commands/Auto.java | 18 ++++++++++++------ .../plot/commands/Claim.java | 9 ++++++++- .../plot/object/PlotPlayer.java | 4 +++- 3 files changed, 23 insertions(+), 8 deletions(-) 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 67d4fc007..098923bdb 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java @@ -14,6 +14,7 @@ import com.intellectualcrafters.plot.util.ByteArrayUtilities; import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; +import com.intellectualcrafters.plot.util.TaskManager; import com.plotsquared.general.commands.CommandDeclaration; @CommandDeclaration(command = "auto", @@ -136,12 +137,17 @@ public class Auto extends SubCommand { final String finalSchematic = schematic; autoClaimSafe(player, plotarea, null, new RunnableVal() { @Override - public void run(Plot value) { - if (value == null) { - MainUtil.sendMessage(player, C.NO_FREE_PLOTS); - } else { - value.claim(player, true, finalSchematic, false); - } + public void run(final Plot plot) { + TaskManager.IMP.sync(new RunnableVal() { + @Override + public void run(Object ignore) { + if (value == null) { + MainUtil.sendMessage(player, C.NO_FREE_PLOTS); + } else { + plot.claim(player, true, finalSchematic, false); + } + } + }); } }); return true; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java index 15674e16b..019882d0a 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java @@ -8,9 +8,11 @@ import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.util.ByteArrayUtilities; import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.Permissions; +import com.intellectualcrafters.plot.util.TaskManager; import com.plotsquared.general.commands.CommandDeclaration; @CommandDeclaration(command = "claim", @@ -88,7 +90,12 @@ public class Claim extends SubCommand { DBFunc.createPlotSafe(plot, new Runnable() { @Override public void run() { - plot.claim(player, true, finalSchematic, false); + TaskManager.IMP.sync(new RunnableVal() { + @Override + public void run(Object value) { + plot.claim(player, true, finalSchematic, false); + } + }); } }, new Runnable() { @Override diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java index 88d145d68..bb8f69c37 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java @@ -508,7 +508,9 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Object o) { - teleport(loc); + if (getMeta("teleportOnLogin", true)) { + teleport(loc); + } } }); }