diff --git a/build.gradle b/build.gradle index 3481d49..b1fdf6a 100644 --- a/build.gradle +++ b/build.gradle @@ -9,8 +9,8 @@ version = '1.0.3' repositories { mavenCentral() maven { - name = "spigotmc-repo" - url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" + name = "papermc-repo" + url = "https://repo.papermc.io/repository/maven-public/" } maven { name = "sonatype" @@ -27,7 +27,7 @@ repositories { } dependencies { - compileOnly "org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT" + compileOnly "io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT" compileOnly "org.popcraft:bolt-common:1.0.575" compileOnly "org.popcraft:bolt-bukkit:1.0.575" compileOnly "com.sk89q.worldguard:worldguard-bukkit:7.0.7" diff --git a/src/main/java/org/popcraft/boltworldguard/BoltWorldGuard.java b/src/main/java/org/popcraft/boltworldguard/BoltWorldGuard.java index cbc5ca1..9b58761 100644 --- a/src/main/java/org/popcraft/boltworldguard/BoltWorldGuard.java +++ b/src/main/java/org/popcraft/boltworldguard/BoltWorldGuard.java @@ -223,15 +223,21 @@ public boolean onCommand(CommandSender sender, Command command, String label, St for (int x = minBlockX; x <= maxBlockX; x++) { for (int y = minBlockY; y <= maxBlockY; y++) { for (int z = minBlockZ; z <= maxBlockZ; z++) { - final Block block = bukkitWorld.getBlockAt(x, y, z); - if (!bolt.isProtectable(block) || bolt.isProtected(block)) { - continue; - } - if (material != null && !material.equals(block.getType())) { - continue; - } - final BlockProtection blockProtection = bolt.createProtection(block, protectOwner, protectType); - bolt.saveProtection(blockProtection); + final Material finalMaterial = material; + final int finalX = x; + final int finalY = y; + final int finalZ = z; + Bukkit.getRegionScheduler().execute(this, bukkitWorld, x >> 4, z >> 4, () -> { + final Block block = bukkitWorld.getBlockAt(finalX, finalY, finalZ); + if (!bolt.isProtectable(block) || bolt.isProtected(block)) { + return; + } + if (finalMaterial != null && !finalMaterial.equals(block.getType())) { + return; + } + final BlockProtection blockProtection = bolt.createProtection(block, protectOwner, protectType); + bolt.saveProtection(blockProtection); + }); } } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index a9d17a8..a40db83 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -3,6 +3,7 @@ version: '${version}' main: org.popcraft.boltworldguard.BoltWorldGuard api-version: 1.19 depend: [ Bolt, WorldGuard ] +folia-supported: true commands: protectregion: description: Protect in a region