From 30dc20b3b319914b794ae9655cd124aca89ff27d Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 29 Mar 2016 17:06:58 +1100 Subject: [PATCH] Fix "Fixes #1015" not resetting the home location. Resetting involves clearing the current value i.e. so it respects whatever is set in the config, if that value is changed. --- .../intellectualcrafters/plot/commands/SetHome.java | 13 +------------ .../com/intellectualcrafters/plot/object/Plot.java | 8 ++++++-- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/SetHome.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/SetHome.java index 4f7f5ca69..a4896f9a8 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/SetHome.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/SetHome.java @@ -21,7 +21,6 @@ package com.intellectualcrafters.plot.commands; import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.object.BlockLoc; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; @@ -46,19 +45,9 @@ public class SetHome extends SetCommand { case "none": { Plot base = plot.getBasePlot(false); Location bot = base.getBottomAbs(); - Location defaultHome = base.getDefaultHome(); - BlockLoc bLoc = new BlockLoc(defaultHome.getX() - bot.getX(), defaultHome.getY(), defaultHome.getZ() - bot.getZ(), defaultHome.getYaw(), defaultHome.getPitch()); - base.setHome(bLoc); + base.setHome(null); return MainUtil.sendMessage(plr, C.POSITION_UNSET); } - case "": { - Plot base = plot.getBasePlot(false); - Location bot = base.getBottomAbs(); - Location loc = plr.getLocationFull(); - BlockLoc rel = new BlockLoc(loc.getX() - bot.getX(), loc.getY(), loc.getZ() - bot.getZ(), loc.getYaw(), loc.getPitch()); - base.setHome(rel); - return MainUtil.sendMessage(plr, C.POSITION_SET); - } default: { MainUtil.sendMessage(plr, C.HOME_ARGUMENT); return false; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java b/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java index 0462c73ae..5672d3afa 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java @@ -1133,11 +1133,15 @@ public class Plot { */ public void setHome(BlockLoc location) { Plot plot = this.getBasePlot(false); - if (new BlockLoc(0, 0, 0).equals(location)) { + if (location != null && new BlockLoc(0, 0, 0).equals(location)) { return; } plot.getSettings().setPosition(location); - DBFunc.setPosition(plot, plot.getSettings().getPosition().toString()); + if (location != null) { + DBFunc.setPosition(plot, plot.getSettings().getPosition().toString()); + return; + } + DBFunc.setPosition(plot, null); } /**