Cover a couple of NPEs

This commit is contained in:
NotMyFault 2021-03-01 16:21:12 +01:00
parent 5780ad370a
commit 31de7de385
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
2 changed files with 5 additions and 0 deletions

View File

@ -27,6 +27,7 @@ package com.plotsquared.core.command;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.PlotArea;
@CommandDeclaration(command = "chat", @CommandDeclaration(command = "chat",
usage = "/plot chat", usage = "/plot chat",
@ -37,6 +38,8 @@ public class Chat extends SubCommand {
@Override @Override
public boolean onCommand(PlotPlayer<?> player, String[] args) { public boolean onCommand(PlotPlayer<?> player, String[] args) {
PlotArea area = player.getPlotAreaAbs();
check(area, TranslatableCaption.of("errors.not_in_plot_world"));
if (player.getPlotAreaAbs().isForcingPlotChat()) { if (player.getPlotAreaAbs().isForcingPlotChat()) {
player.sendMessage(TranslatableCaption.of("chat.plot_chat_forced")); player.sendMessage(TranslatableCaption.of("chat.plot_chat_forced"));
return true; return true;

View File

@ -68,6 +68,8 @@ public class DebugRoadRegen extends SubCommand {
return false; return false;
} }
PlotArea area = player.getPlotAreaAbs();
check(area, TranslatableCaption.of("errors.not_in_plot_world"));
if (plot.getVolume() > Integer.MAX_VALUE) { if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
return false; return false;