Allow /plot home [area|world]

This commit is contained in:
dordsor21 2020-09-11 15:03:48 +01:00
parent 648953ec1f
commit d843d1715d
No known key found for this signature in database
GPG key ID: 1E53E88969FFCF0B

View file

@ -107,6 +107,7 @@ public class HomeCommand extends Command {
PlotQuery query = query(player); PlotQuery query = query(player);
int page = 1; // page = index + 1 int page = 1; // page = index + 1
String identifier; String identifier;
PlotArea plotArea;
boolean basePlotOnly = true; boolean basePlotOnly = true;
switch (args.length) { switch (args.length) {
case 1: case 1:
@ -129,12 +130,18 @@ public class HomeCommand extends Command {
query.withPlot(fromId); query.withPlot(fromId);
break; break;
} }
// allow for plot home within a plot area
plotArea = PlotSquared.get().getPlotAreaByString(args[0]);
if (plotArea != null) {
query.inArea(plotArea);
break;
}
// it wasn't a valid plot id, trying to find plot by alias // it wasn't a valid plot id, trying to find plot by alias
query.withAlias(identifier); query.withAlias(identifier);
break; break;
case 2: case 2:
// we assume args[0] is a plot area and args[1] an identifier // we assume args[0] is a plot area and args[1] an identifier
PlotArea plotArea = PlotSquared.get().getPlotAreaByString(args[0]); plotArea = PlotSquared.get().getPlotAreaByString(args[0]);
identifier = args[1]; identifier = args[1];
if (plotArea == null) { if (plotArea == null) {
// invalid command, therefore no plots // invalid command, therefore no plots