mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Check if location has PlotArea to avoid NPE
This commit is contained in:
parent
d106262454
commit
a94c588a17
@ -4,6 +4,7 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
@ -16,13 +17,17 @@ public class DebugRoadRegen extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer player, String[] args) {
|
||||
Location loc = player.getLocation();
|
||||
PlotManager manager = loc.getPlotArea().getPlotManager();
|
||||
PlotArea area = loc.getPlotArea();
|
||||
if (area == null) {
|
||||
return sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
||||
}
|
||||
Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
Captions.NOT_IN_PLOT.send(player);
|
||||
} else if (plot.isMerged()) {
|
||||
Captions.REQUIRES_UNMERGED.send(player);
|
||||
} else {
|
||||
PlotManager manager = area.getPlotManager();
|
||||
manager.createRoadEast(plot);
|
||||
manager.createRoadSouth(plot);
|
||||
manager.createRoadSouthEast(plot);
|
||||
|
Loading…
Reference in New Issue
Block a user