Fix home command reset (#4295)

* 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 <seelenretterin@onelitefeather.net>
This commit is contained in:
OneLiteFeather 2024-01-20 00:34:46 +01:00 committed by GitHub
parent 6371cd4c5a
commit a1d94af242
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -2401,7 +2401,8 @@ public class SQLManager implements AbstractDB {
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));
}

View File

@ -1483,7 +1483,7 @@ public class Plot {
*/
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);