mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-04 09:10:17 +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;
|
||||
|
||||
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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user