diff --git a/pom.xml b/pom.xml
index 6077552..8e620db 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,6 +45,10 @@
reserve-repo
https://dl.bintray.com/theneweconomy/java/
+
+ jitpack.io
+ https://jitpack.io
+
@@ -240,6 +244,19 @@
+
+ com.github.TechFortress
+ GriefPrevention
+ 16.12.0
+ provided
+
+
+ org.bukkit
+ bukkit
+
+
+
+
com.webkonsept.bukkit.simplechestlock
simplechestlock
diff --git a/src/main/java/com/Acrobot/ChestShop/Configuration/Properties.java b/src/main/java/com/Acrobot/ChestShop/Configuration/Properties.java
index 1120cf2..5449599 100644
--- a/src/main/java/com/Acrobot/ChestShop/Configuration/Properties.java
+++ b/src/main/java/com/Acrobot/ChestShop/Configuration/Properties.java
@@ -232,7 +232,7 @@ public class Properties {
public static boolean REMOVE_LWC_PROTECTION_AUTOMATICALLY = true;
@PrecededBySpace
- @ConfigurationComment("Do you want to only let people build inside regions?")
+ @ConfigurationComment("Do you want to only let people build inside WorldGuard regions?")
public static boolean WORLDGUARD_INTEGRATION = false;
@ConfigurationComment("Do you want to only let people build inside region flagged by doing /region regionName flag allow-shop allow?")
@@ -241,6 +241,10 @@ public class Properties {
@ConfigurationComment("Do you want ChestShop to respect WorldGuard's chest protection?")
public static boolean WORLDGUARD_USE_PROTECTION = false;
+ @PrecededBySpace
+ @ConfigurationComment("Do you want to only let people build inside GriefPrevention claims?")
+ public static boolean GRIEFPREVENTION_INTEGRATION = false;
+
@PrecededBySpace
@ConfigurationComment("Do you want to deny shop access to unlogged users?")
public static boolean AUTHME_HOOK = true;
diff --git a/src/main/java/com/Acrobot/ChestShop/Dependencies.java b/src/main/java/com/Acrobot/ChestShop/Dependencies.java
index 3bf290a..61ea852 100644
--- a/src/main/java/com/Acrobot/ChestShop/Dependencies.java
+++ b/src/main/java/com/Acrobot/ChestShop/Dependencies.java
@@ -5,7 +5,6 @@ import com.Acrobot.ChestShop.Configuration.Properties;
import com.Acrobot.ChestShop.Listeners.Economy.Plugins.ReserveListener;
import com.Acrobot.ChestShop.Listeners.Economy.Plugins.VaultListener;
import com.Acrobot.ChestShop.Plugins.*;
-import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
@@ -126,7 +125,6 @@ public class Dependencies {
//Terrain protection plugins
case WorldGuard:
- WorldGuardPlugin worldGuard = (WorldGuardPlugin) plugin;
boolean inUse = Properties.WORLDGUARD_USE_PROTECTION || Properties.WORLDGUARD_INTEGRATION;
if (!inUse) {
@@ -134,15 +132,22 @@ public class Dependencies {
}
if (Properties.WORLDGUARD_USE_PROTECTION) {
- ChestShop.registerListener(new WorldGuardProtection(worldGuard));
+ ChestShop.registerListener(new WorldGuardProtection(plugin));
}
if (Properties.WORLDGUARD_INTEGRATION) {
- listener = new WorldGuardBuilding(worldGuard);
+ listener = new WorldGuardBuilding(plugin);
}
break;
+ case GriefPrevention:
+ if (!Properties.GRIEFPREVENTION_INTEGRATION) {
+ return;
+ }
+ listener = new GriefPrevenentionBuilding(plugin);
+ break;
+
//Other plugins
case Heroes:
Heroes heroes = Heroes.getHeroes(plugin);
@@ -179,6 +184,7 @@ public class Dependencies {
OddItem,
WorldGuard,
+ GriefPrevention,
Heroes,
diff --git a/src/main/java/com/Acrobot/ChestShop/Plugins/GriefPrevenentionBuilding.java b/src/main/java/com/Acrobot/ChestShop/Plugins/GriefPrevenentionBuilding.java
new file mode 100644
index 0000000..b3877be
--- /dev/null
+++ b/src/main/java/com/Acrobot/ChestShop/Plugins/GriefPrevenentionBuilding.java
@@ -0,0 +1,23 @@
+package com.Acrobot.ChestShop.Plugins;
+
+import com.Acrobot.ChestShop.Events.Protection.BuildPermissionEvent;
+import me.ryanhamshire.GriefPrevention.GriefPrevention;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.plugin.Plugin;
+
+/**
+ * @author Acrobot
+ */
+public class GriefPrevenentionBuilding implements Listener {
+ private GriefPrevention griefPrevention;
+
+ public GriefPrevenentionBuilding(Plugin plugin) {
+ this.griefPrevention = (GriefPrevention) plugin;
+ }
+
+ @EventHandler
+ public void canBuild(BuildPermissionEvent event) {
+ event.allow(griefPrevention.dataStore.getClaimAt(event.getSign(), false, null) != null);
+ }
+}
diff --git a/src/main/java/com/Acrobot/ChestShop/Plugins/WorldGuardBuilding.java b/src/main/java/com/Acrobot/ChestShop/Plugins/WorldGuardBuilding.java
index a062166..049367d 100644
--- a/src/main/java/com/Acrobot/ChestShop/Plugins/WorldGuardBuilding.java
+++ b/src/main/java/com/Acrobot/ChestShop/Plugins/WorldGuardBuilding.java
@@ -12,6 +12,7 @@ import com.sk89q.worldguard.protection.managers.RegionManager;
import org.bukkit.Location;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
+import org.bukkit.plugin.Plugin;
/**
* @author Acrobot
@@ -20,8 +21,8 @@ public class WorldGuardBuilding implements Listener {
private WorldGuardPlugin worldGuard;
private WorldGuardPlatform worldGuardPlatform;
- public WorldGuardBuilding(WorldGuardPlugin plugin) {
- this.worldGuard = plugin;
+ public WorldGuardBuilding(Plugin plugin) {
+ this.worldGuard = (WorldGuardPlugin) plugin;
this.worldGuardPlatform = WorldGuard.getInstance().getPlatform();
}
diff --git a/src/main/java/com/Acrobot/ChestShop/Plugins/WorldGuardProtection.java b/src/main/java/com/Acrobot/ChestShop/Plugins/WorldGuardProtection.java
index e95354e..7c161db 100644
--- a/src/main/java/com/Acrobot/ChestShop/Plugins/WorldGuardProtection.java
+++ b/src/main/java/com/Acrobot/ChestShop/Plugins/WorldGuardProtection.java
@@ -16,6 +16,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
+import org.bukkit.plugin.Plugin;
/**
* @author Acrobot
@@ -24,8 +25,8 @@ public class WorldGuardProtection implements Listener {
private WorldGuardPlugin worldGuard;
private WorldGuardPlatform worldGuardPlatform;
- public WorldGuardProtection(WorldGuardPlugin worldGuard) {
- this.worldGuard = worldGuard;
+ public WorldGuardProtection(Plugin plugin) {
+ this.worldGuard =(WorldGuardPlugin) plugin;
this.worldGuardPlatform = WorldGuard.getInstance().getPlatform();
}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index f2e9738..d4f0cc1 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -4,7 +4,7 @@ version: '${bukkit.plugin.version}'
author: Acrobot
authors: ['https://github.com/ChestShop-authors/ChestShop-3/contributors']
description: A chest shop for economy plugins.
-softdepend: [Vault, Reserve, LWC, Lockette, Deadbolt, OddItem, WorldGuard, Heroes, SimpleChestLock, Residence, ShowItem]
+softdepend: [Vault, Reserve, LWC, Lockette, Deadbolt, OddItem, WorldGuard, GriefPrevention, Heroes, SimpleChestLock, Residence, ShowItem]
api-version: '1.13'
commands: