Skip to content

Commit

Permalink
Fix home command reset (#4295)
Browse files Browse the repository at this point in the history
* Add location not null check
The issue lies within the equals implementation

* Fix setposition method with default value.
Also add a comment too.

---------

Co-authored-by: OneLiteFeather <[email protected]>
  • Loading branch information
OneLiteFeather and OneLiteFeather authored Jan 19, 2024
1 parent 6371cd4 commit a1d94af
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2401,7 +2401,8 @@ public void setPosition(final Plot plot, final String position) {
addPlotTask(plot, new UniqueStatement("setPosition") {
@Override
public void set(PreparedStatement statement) throws SQLException {
statement.setString(1, position == null ? "" : position);
// Please see the table creation statement. There is the default value of "default"
statement.setString(1, position == null ? "DEFAULT" : position);
statement.setInt(2, getId(plot));
}

Expand Down
2 changes: 1 addition & 1 deletion Core/src/main/java/com/plotsquared/core/plot/Plot.java
Original file line number Diff line number Diff line change
Expand Up @@ -1483,7 +1483,7 @@ private Location toHomeLocation(Location bottom, BlockLoc relativeHome) {
*/
public void setHome(BlockLoc location) {
Plot plot = this.getBasePlot(false);
if (BlockLoc.ZERO.equals(location) || BlockLoc.MINY.equals(location)) {
if (location != null && (BlockLoc.ZERO.equals(location) || BlockLoc.MINY.equals(location))) {
return;
}
plot.getSettings().setPosition(location);
Expand Down

0 comments on commit a1d94af

Please sign in to comment.