From bbb3736846d2c112b38147fa61fc0551cce0ea54 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Tue, 13 Aug 2024 07:40:09 +0200 Subject: [PATCH] Prevent out of world claims (#4475) * Prevent out of world claims * update java version in workflows --- .github/workflows/build-pr.yml | 2 +- .github/workflows/build.yml | 2 +- .github/workflows/codeql.yml | 2 +- Core/src/main/java/com/plotsquared/core/plot/Plot.java | 3 +++ build.gradle.kts | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 0a2f32f4d..6c772b3af 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -16,6 +16,6 @@ jobs: uses: actions/setup-java@v4 with: distribution: temurin - java-version: 17 + java-version: 21 - name: Clean Build run: ./gradlew clean build diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f61f4da12..6d09b36bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: temurin - java-version: 17 + java-version: 21 - name: Clean Build run: ./gradlew clean build - name: Determine release status diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 0ab157734..43f2659e0 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -25,7 +25,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: temurin - java-version: 17 + java-version: 21 - name: Initialize CodeQL uses: github/codeql-action/init@v3 with: diff --git a/Core/src/main/java/com/plotsquared/core/plot/Plot.java b/Core/src/main/java/com/plotsquared/core/plot/Plot.java index 91f6016b1..3913ddfc5 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java +++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java @@ -2182,6 +2182,9 @@ public class Plot { * @return if the given player can claim the plot */ public boolean canClaim(@NonNull PlotPlayer player) { + if (!WorldUtil.isValidLocation(getBottomAbs())) { + return false; + } PlotCluster cluster = this.getCluster(); if (cluster != null) { if (!cluster.isAdded(player.getUUID()) && !player.hasPermission("plots.admin.command.claim")) { diff --git a/build.gradle.kts b/build.gradle.kts index 8b3cac8e8..2c308a9ff 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -85,7 +85,7 @@ subprojects { plugins.withId("java") { the().toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) + languageVersion.set(JavaLanguageVersion.of(21)) } }