diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 275c96b38..d7d8ad300 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repository - uses: actions/checkout@v2.3.5 + uses: actions/checkout@v2.4.0 - name: Validate Gradle Wrapper" uses: gradle/wrapper-validation-action@v1.0.4 - name: Setup Java diff --git a/.whitesource b/.whitesource new file mode 100644 index 000000000..1a6d4ff8c --- /dev/null +++ b/.whitesource @@ -0,0 +1,13 @@ +{ + "scanSettings": { + "baseBranches": ["v6"] + }, + "checkRunSettings": { + "vulnerableCheckRunConclusionLevel": "success", + "displayMode": "diff" + }, + "issueSettings": { + "minSeverityLevel": "LOW" + }, + "enableRenovate": "true" +} diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java index 151c2f40a..783622e63 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntitySpawnListener.java @@ -75,7 +75,7 @@ public class EntitySpawnListener implements Listener { public static void testCreate(final Entity entity) { @NonNull World world = entity.getWorld(); - if (areaName == world.getName()) { + if (areaName.equals(world.getName())) { } else { areaName = world.getName(); hasPlotArea = PlotSquared.get().getPlotAreaManager().hasPlotArea(areaName); 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 041c2b48b..8e3a57157 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java +++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java @@ -58,6 +58,7 @@ import com.plotsquared.core.plot.flag.implementations.KeepFlag; import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag; import com.plotsquared.core.plot.flag.types.DoubleFlag; import com.plotsquared.core.plot.schematic.Schematic; +import com.plotsquared.core.plot.world.SinglePlotArea; import com.plotsquared.core.queue.QueueCoordinator; import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.MathMan; @@ -1512,6 +1513,12 @@ public class Plot { int z; if (loc.getX() == Integer.MAX_VALUE && loc.getZ() == Integer.MAX_VALUE) { // center + if (getArea() instanceof SinglePlotArea) { + int y = loc.getY() == Integer.MIN_VALUE + ? (isLoaded() ? this.worldUtil.getHighestBlockSynchronous(plot.getWorldName(), 0, 0) + 1 : 63) + : loc.getY(); + return Location.at(plot.getWorldName(), 0, y, 0, 0, 0); + } CuboidRegion largest = plot.getLargestRegion(); x = (largest.getMaximumPoint().getX() >> 1) - (largest.getMinimumPoint().getX() >> 1) + largest .getMinimumPoint() @@ -1530,6 +1537,10 @@ public class Plot { : loc.getY(); return Location.at(plot.getWorldName(), x, y, z, loc.getYaw(), loc.getPitch()); } + if (getArea() instanceof SinglePlotArea) { + int y = isLoaded() ? this.worldUtil.getHighestBlockSynchronous(plot.getWorldName(), 0, 0) + 1 : 63; + return Location.at(plot.getWorldName(), 0, y, 0, 0, 0); + } // Side return plot.getSideSynchronous(); } @@ -1551,13 +1562,18 @@ public class Plot { int z; if (loc.getX() == Integer.MAX_VALUE && loc.getZ() == Integer.MAX_VALUE) { // center - CuboidRegion largest = plot.getLargestRegion(); - x = (largest.getMaximumPoint().getX() >> 1) - (largest.getMinimumPoint().getX() >> 1) + largest - .getMinimumPoint() - .getX(); - z = (largest.getMaximumPoint().getZ() >> 1) - (largest.getMinimumPoint().getZ() >> 1) + largest - .getMinimumPoint() - .getZ(); + if (getArea() instanceof SinglePlotArea) { + x = 0; + z = 0; + } else { + CuboidRegion largest = plot.getLargestRegion(); + x = (largest.getMaximumPoint().getX() >> 1) - (largest.getMinimumPoint().getX() >> 1) + largest + .getMinimumPoint() + .getX(); + z = (largest.getMaximumPoint().getZ() >> 1) - (largest.getMinimumPoint().getZ() >> 1) + largest + .getMinimumPoint() + .getZ(); + } } else { // specific Location bot = plot.getBottomAbs(); @@ -1582,6 +1598,10 @@ public class Plot { return; } // Side + if (getArea() instanceof SinglePlotArea) { + int y = isLoaded() ? this.worldUtil.getHighestBlockSynchronous(plot.getWorldName(), 0, 0) + 1 : 63; + result.accept(Location.at(plot.getWorldName(), 0, y, 0, 0, 0)); + } plot.getSide(result); } diff --git a/Core/src/main/java/com/plotsquared/core/util/StringMan.java b/Core/src/main/java/com/plotsquared/core/util/StringMan.java index ee7a614b8..388e46135 100644 --- a/Core/src/main/java/com/plotsquared/core/util/StringMan.java +++ b/Core/src/main/java/com/plotsquared/core/util/StringMan.java @@ -286,15 +286,13 @@ public class StringMan { } public static boolean isEqualIgnoreCase(String a, String b) { - return (a == b) || ((a != null) && (b != null) && (a.length() == b.length()) && a + return (a.equals(b)) || ((a != null) && (b != null) && (a.length() == b.length()) && a .equalsIgnoreCase(b)); } public static String repeat(String s, int n) { StringBuilder sb = new StringBuilder(); - for (int i = 0; i < n; i++) { - sb.append(s); - } + sb.append(String.valueOf(s).repeat(Math.max(0, n))); return sb.toString(); } diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index b3bbc54ab..03f0813df 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -22,7 +22,7 @@ "web.plot_merged": "This plot is merged and therefore cannot be downloaded", "web.generating_link_failed": "Failed to generate download link for plot !", "web.generation_link_success": "Download: > \n Deletion: >\nAttention: Opening the deletion link will delete the file immediately.", - "web.generation_link_success_legacy_world": "Download: >", + "web.generation_link_success_legacy_world": "Download: >", "web.save_failed": "Failed to save.", "web.load_null": "Please use to get a list of schematics.", "web.load_failed": "Failed to load schematic.", diff --git a/build.gradle.kts b/build.gradle.kts index ef5e2f993..af881d5b4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -72,10 +72,18 @@ allprojects { plugins.withId("java") { the().toolchain { - languageVersion.set(JavaLanguageVersion.of(16)) + languageVersion.set(JavaLanguageVersion.of(17)) } } + tasks.compileJava.configure { + options.release.set(16) + } + + configurations.all { + attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 17) + } + configure { header(rootProject.file("HEADER.txt")) include("**/*.java") diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c295c94ed..75e2de0e6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,15 +1,15 @@ [versions] # Minecraft expectations -gson = "2.8.0" # Version set by Minecraft -log4j-api = "2.16.0" # Version set by Minecraft -guava = "21.0" # Version set by Minecraft +gson = "2.8.9" # Version set by Minecraft +log4j-api = "2.17.0" # Version set by Minecraft +guava = "31.0.1-jre" # Version set by Minecraft # Platform expectations -paper = "1.17.1-R0.1-SNAPSHOT" -checker-qual = "3.20.0" +paper = "1.18.1-R0.1-SNAPSHOT" +checker-qual = "3.21.0" guice = "5.0.1" findbugs = "3.0.1" -snakeyaml = "1.28" # Version set by Bukkit +snakeyaml = "1.30" # Version set by Bukkit # Adventure & MiniMessage adventure-api = "4.10.0-SNAPSHOT" @@ -19,9 +19,9 @@ adventure-platform-bukkit = "4.0.1" worldedit = "7.2.8" fawe = "1.17-419" vault = "1.7.1" -placeholderapi = "2.10.10" +placeholderapi = "2.11.0" luckperms = "5.3" -essentialsx = "2.19.0" +essentialsx = "2.19.2" hyperverse = "0.6.0-SNAPSHOT" mvdwapi = "3.1.1" @@ -30,7 +30,7 @@ prtree = "2.0.0" aopalliance = "1.0" rorledning = "1.4.0-SNAPSHOT" arkitektonika = "2.1.1" -paster = "1.1.1" +paster = "1.1.3" bstats = "2.2.1" paperlib = "1.0.7" squirrelid = "0.3.0" @@ -38,7 +38,7 @@ serverlib = "2.3.1" http4j = "1.3" # Gradle plugins -shadow = "7.1.0" +shadow = "7.1.1" grgit = "4.1.1" licenser = "0.6.1" nexus = "1.1.0" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 84d1f85fd..d2880ba80 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists