Minor adjustment to plot home location logic

- Allow "centre" spelling
 - ClassicPlotWorld contains the PLOT_HEIGHT config setting, not HPW
This commit is contained in:
dordsor21 2021-11-02 15:41:16 +00:00
parent b97e843849
commit 3d4d413de8
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
4 changed files with 11 additions and 7 deletions

View File

@ -2099,6 +2099,7 @@ public class SQLManager implements AbstractDB {
case "default":
case "0,0,0":
case "center":
case "centre":
break;
default:
try {
@ -2946,6 +2947,7 @@ public class SQLManager implements AbstractDB {
case "default":
case "0,0,0":
case "center":
case "centre":
break;
default:
try {

View File

@ -56,7 +56,7 @@ public final class PlotLoc {
public static @Nullable PlotLoc fromString(final String input) {
if (input == null || "side".equalsIgnoreCase(input)) {
return null;
} else if (StringMan.isEqualIgnoreCaseToAny(input, "center", "middle")) {
} else if (StringMan.isEqualIgnoreCaseToAny(input, "center", "middle", "centre")) {
return new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE);
} else {
try {

View File

@ -39,6 +39,7 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.events.Result;
import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.generator.ClassicPlotWorld;
import com.plotsquared.core.generator.HybridPlotWorld;
import com.plotsquared.core.listener.PlotListener;
import com.plotsquared.core.location.BlockLoc;
@ -1328,7 +1329,7 @@ public class Plot {
return Location.at(
"",
0,
this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
0
);
}
@ -1403,7 +1404,7 @@ public class Plot {
return Location.at(
"",
0,
this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
0
);
}
@ -1442,7 +1443,7 @@ public class Plot {
result.accept(Location.at(
"",
0,
this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
0
));
return;
@ -1539,7 +1540,7 @@ public class Plot {
result.accept(Location.at(
"",
0,
this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
0
));
return;
@ -1572,7 +1573,8 @@ public class Plot {
y -> result.accept(Location.at(plot.getWorldName(), x, y + 1, z))
);
} else {
result.accept(Location.at(plot.getWorldName(), x, 63, z, loc.getYaw(), loc.getPitch()));
int y = this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 63;
result.accept(Location.at(plot.getWorldName(), x, y, z, loc.getYaw(), loc.getPitch()));
}
} else {
result.accept(Location.at(plot.getWorldName(), x, loc.getY(), z, loc.getYaw(), loc.getPitch()));

View File

@ -381,7 +381,7 @@ public abstract class PlotArea {
if ("side".equalsIgnoreCase(homeDefault)) {
this.defaultHome = null;
} else if (StringMan.isEqualIgnoreCaseToAny(homeDefault, "center", "middle")) {
} else if (StringMan.isEqualIgnoreCaseToAny(homeDefault, "center", "middle", "centre")) {
this.defaultHome = new BlockLoc(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE);
} else {
try {