From a94c588a1727696ec6a744b7b1f63b4d834e40a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kriv=C3=A1cs=20Schr=C3=B8der?= Date: Fri, 31 May 2019 21:16:29 +0200 Subject: [PATCH] Check if location has PlotArea to avoid NPE --- .../plotsquared/plot/commands/DebugRoadRegen.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java index 1880cd6b0..7d69db823 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugRoadRegen.java @@ -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);