mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
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.
This commit is contained in:
parent
32ba55baf5
commit
30dc20b3b3
@ -21,7 +21,6 @@
|
|||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.BlockLoc;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
@ -46,19 +45,9 @@ public class SetHome extends SetCommand {
|
|||||||
case "none": {
|
case "none": {
|
||||||
Plot base = plot.getBasePlot(false);
|
Plot base = plot.getBasePlot(false);
|
||||||
Location bot = base.getBottomAbs();
|
Location bot = base.getBottomAbs();
|
||||||
Location defaultHome = base.getDefaultHome();
|
base.setHome(null);
|
||||||
BlockLoc bLoc = new BlockLoc(defaultHome.getX() - bot.getX(), defaultHome.getY(), defaultHome.getZ() - bot.getZ(), defaultHome.getYaw(), defaultHome.getPitch());
|
|
||||||
base.setHome(bLoc);
|
|
||||||
return MainUtil.sendMessage(plr, C.POSITION_UNSET);
|
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: {
|
default: {
|
||||||
MainUtil.sendMessage(plr, C.HOME_ARGUMENT);
|
MainUtil.sendMessage(plr, C.HOME_ARGUMENT);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1133,11 +1133,15 @@ public class Plot {
|
|||||||
*/
|
*/
|
||||||
public void setHome(BlockLoc location) {
|
public void setHome(BlockLoc location) {
|
||||||
Plot plot = this.getBasePlot(false);
|
Plot plot = this.getBasePlot(false);
|
||||||
if (new BlockLoc(0, 0, 0).equals(location)) {
|
if (location != null && new BlockLoc(0, 0, 0).equals(location)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plot.getSettings().setPosition(location);
|
plot.getSettings().setPosition(location);
|
||||||
|
if (location != null) {
|
||||||
DBFunc.setPosition(plot, plot.getSettings().getPosition().toString());
|
DBFunc.setPosition(plot, plot.getSettings().getPosition().toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DBFunc.setPosition(plot, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user