Compare commits

..

2 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
4e8f775772 Fix NullPointerException when listing plots from console
Co-authored-by: NotMyFault <13383509+NotMyFault@users.noreply.github.com>
2025-09-26 20:10:44 +00:00
copilot-swe-agent[bot]
31d27861e3 Initial plan 2025-09-26 20:04:12 +00:00
3 changed files with 14 additions and 9 deletions

View File

@@ -150,8 +150,9 @@ public class ListCmd extends SubCommand {
page = 0; page = 0;
} }
String world = player.getCurrentPlot().getWorldName(); Plot currentPlot = player.getCurrentPlot();
PlotArea area = player.getCurrentPlot().getArea(); String world = currentPlot != null ? currentPlot.getWorldName() : null;
PlotArea area = currentPlot != null ? currentPlot.getArea() : null;
String arg = args[0].toLowerCase(); String arg = args[0].toLowerCase();
final boolean[] sort = new boolean[]{true}; final boolean[] sort = new boolean[]{true};
@@ -226,13 +227,17 @@ public class ListCmd extends SubCommand {
); );
return false; return false;
} }
if (!player.hasPermission("plots.list.world." + world)) { if (world != null && !player.hasPermission("plots.list.world." + world)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world." + world))) TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world." + world)))
); );
return false; return false;
} }
if (world == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
return false;
}
plotConsumer.accept(PlotQuery.newQuery().inWorld(world)); plotConsumer.accept(PlotQuery.newQuery().inWorld(world));
} }
case "expired" -> { case "expired" -> {
@@ -257,7 +262,7 @@ public class ListCmd extends SubCommand {
); );
return false; return false;
} }
if (!player.hasPermission("plots.list.world." + world)) { if (world != null && !player.hasPermission("plots.list.world." + world)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world." + world))) TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world." + world)))

View File

@@ -67,8 +67,8 @@ subprojects {
dependencies { dependencies {
// Tests // Tests
testImplementation("org.junit.jupiter:junit-jupiter:5.14.0") testImplementation("org.junit.jupiter:junit-jupiter:5.13.4")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.14.0") testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.13.4")
} }
plugins.withId("java") { plugins.withId("java") {

View File

@@ -3,7 +3,7 @@
paper = "1.20.4-R0.1-SNAPSHOT" paper = "1.20.4-R0.1-SNAPSHOT"
guice = "7.0.0" guice = "7.0.0"
spotbugs = "4.9.6" spotbugs = "4.9.6"
checkerqual = "3.51.1" checkerqual = "3.51.0"
gson = "2.10" gson = "2.10"
guava = "31.1-jre" guava = "31.1-jre"
snakeyaml = "2.0" snakeyaml = "2.0"
@@ -35,9 +35,9 @@ serverlib = "2.3.7"
# Gradle plugins # Gradle plugins
shadow = "8.3.9" shadow = "8.3.9"
grgit = "4.1.1" grgit = "4.1.1"
spotless = "8.0.0" spotless = "7.2.1"
publish = "0.34.0" publish = "0.34.0"
runPaper = "3.0.1" runPaper = "2.3.1"
[libraries] [libraries]
# Platform expectations # Platform expectations