diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 7739c22..4cda9b0 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -10,13 +10,14 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
- - name: Set up JDK 17
- uses: actions/setup-java@v1
+ - uses: actions/checkout@v4
+ - name: Set up JDK 21
+ uses: actions/setup-java@v4
with:
- java-version: '17' # The JDK version to make available on the path.
+ distribution: 'temurin'
+ java-version: '21'
- name: Cache local Maven repository
- uses: actions/cache@v2
+ uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -24,7 +25,7 @@ jobs:
${{ runner.os }}-maven-
- name: Build with Maven
run: mvn clean package
- - uses: actions/upload-artifact@v2
+ - uses: actions/upload-artifact@v4
with:
name: Creepair (#${{ github.run_number }})
path: target/*.jar
diff --git a/pom.xml b/pom.xml
index 2fbc4f1..30a9556 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
im.wma.dev.Creepair
Creepair
- 0.4-DEV
+ 0.5-DEV
jar
UTF-8
@@ -13,6 +13,10 @@
spigot
https://hub.spigotmc.org/nexus/content/groups/public/
+
+ sk89q-repo
+ https://maven.enginehub.org/repo/
+
@@ -21,6 +25,12 @@
1.21-R0.1-SNAPSHOT
provided
+
+ com.sk89q.worldguard
+ worldguard-bukkit
+ 7.0.10
+ provided
+
Creepair
http://wma.im
@@ -42,8 +52,8 @@
maven-compiler-plugin
3.0
-
- 1.7
+
+ 21
diff --git a/res/config.yml b/res/config.yml
index f8f7e9d..676b830 100644
--- a/res/config.yml
+++ b/res/config.yml
@@ -5,14 +5,15 @@ worlds:
- world
above_y: 54
natural_blocks:
- - GRASS
+ - SHORT_GRASS
+ - TALL_GRASS
- GRASS_BLOCK
- DIRT
- SANDSTONE
- SAND
- GRAVEL
- STONE
- - GRASS_PATH
+ - DIRT_PATH
- ACACIA_LEAVES
- ACACIA_LOG
- BIRCH_LEAVES
diff --git a/res/plugin.yml b/res/plugin.yml
index 93b7aab..91c5bac 100644
--- a/res/plugin.yml
+++ b/res/plugin.yml
@@ -2,7 +2,8 @@ name: Creepair
main: im.wma.dev.creepair.Creepair
version: ${version}
website: http://wma.im
-api-version: 1.16 # Because of this Creepair is not compatible with verisons lower than 1.14
+api-version: 1.20 # Because of this Creepair is not compatible with verisons lower than 1.14
+softdepend: [WorldGuard]
commands:
creepair:
description: Returns the plugin version
diff --git a/src/im/wma/dev/creepair/Creepair.java b/src/im/wma/dev/creepair/Creepair.java
index 4bd7f54..9087365 100644
--- a/src/im/wma/dev/creepair/Creepair.java
+++ b/src/im/wma/dev/creepair/Creepair.java
@@ -4,6 +4,10 @@
import java.util.List;
import java.util.logging.Level;
+import com.sk89q.worldedit.bukkit.BukkitAdapter;
+import com.sk89q.worldguard.WorldGuard;
+import com.sk89q.worldguard.protection.flags.Flags;
+import com.sk89q.worldguard.protection.regions.RegionQuery;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -18,12 +22,15 @@
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
+import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
+
public class Creepair extends JavaPlugin implements Listener {
private final ArrayList worlds = new ArrayList<>();
private final List naturalBlocks = new ArrayList<>();
private int y;
private RepairHelper helper;
+ private WorldGuardPlugin wg = null;
@Override
public void onEnable() {
@@ -69,6 +76,8 @@ public List tabCommand(CommandSender sender, Command rootCommand, String
// Register "/check" command executor with Bukkit.
getCommand("creepair").setExecutor(creepairCommand);
+
+ this.wg = (WorldGuardPlugin) this.getServer().getPluginManager().getPlugin("WorldGuard");
}
public void reloadPluginConfig(CommandSender sender) {
@@ -90,6 +99,15 @@ public void onEntityExplode(EntityExplodeEvent event) {
return;
}
+ // Check WorldGuard status, if present let WorldGuard handle the event in a region with Flags.CREEPER_EXPLOSION
+ if(!(this.wg == null)){
+ RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
+ com.sk89q.worldedit.util.Location loc = BukkitAdapter.adapt(event.getLocation());
+ if (!query.testState(loc, null, Flags.CREEPER_EXPLOSION)) {
+ event.setCancelled(true);
+ }
+ }
+
if (event.getLocation().getBlockY() >= y) {
event.setYield(0F);
for (Block block : event.blockList()) {