diff --git a/pom.xml b/pom.xml index 8e620db..6221360 100644 --- a/pom.xml +++ b/pom.xml @@ -45,6 +45,10 @@ reserve-repo https://dl.bintray.com/theneweconomy/java/ + + redprotect-repo + https://raw.githubusercontent.com/FabioZumbi12/RedProtect/mvn-repo/ + jitpack.io https://jitpack.io @@ -257,6 +261,19 @@ + + br.net.fabiozumbi12.RedProtect + RedProtect-Spigot + 7.6.2 + provided + + + br.net.fabiozumbi12.RedProtect + RedProtect-Core + 7.6.2 + provided + + 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 5449599..f4a7ffc 100644 --- a/src/main/java/com/Acrobot/ChestShop/Configuration/Properties.java +++ b/src/main/java/com/Acrobot/ChestShop/Configuration/Properties.java @@ -245,6 +245,10 @@ public class Properties { @ConfigurationComment("Do you want to only let people build inside GriefPrevention claims?") public static boolean GRIEFPREVENTION_INTEGRATION = false; + @PrecededBySpace + @ConfigurationComment("Do you want to only let people build inside RedProtect regions?") + public static boolean REDPROTECT_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 61ea852..4592ddd 100644 --- a/src/main/java/com/Acrobot/ChestShop/Dependencies.java +++ b/src/main/java/com/Acrobot/ChestShop/Dependencies.java @@ -148,6 +148,13 @@ public class Dependencies { listener = new GriefPrevenentionBuilding(plugin); break; + case RedProtect: + if (!Properties.REDPROTECT_INTEGRATION) { + return; + } + listener = new RedProtectBuilding(plugin); + break; + //Other plugins case Heroes: Heroes heroes = Heroes.getHeroes(plugin); @@ -185,6 +192,7 @@ public class Dependencies { WorldGuard, GriefPrevention, + RedProtect, Heroes, diff --git a/src/main/java/com/Acrobot/ChestShop/Plugins/RedProtectBuilding.java b/src/main/java/com/Acrobot/ChestShop/Plugins/RedProtectBuilding.java new file mode 100644 index 0000000..bc7ee46 --- /dev/null +++ b/src/main/java/com/Acrobot/ChestShop/Plugins/RedProtectBuilding.java @@ -0,0 +1,26 @@ +package com.Acrobot.ChestShop.Plugins; + +import br.net.fabiozumbi12.RedProtect.Bukkit.RedProtect; +import br.net.fabiozumbi12.RedProtect.Bukkit.Region; +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 RedProtectBuilding implements Listener { + private RedProtect redProtect; + + public RedProtectBuilding(Plugin plugin) { + this.redProtect = (RedProtect) plugin; + } + + @EventHandler + public void canBuild(BuildPermissionEvent event) { + Region region = redProtect.getAPI().getRegion(event.getSign()); + event.allow(region != null && region.canBuild(event.getPlayer())); + } +} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d4f0cc1..db7625b 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, GriefPrevention, Heroes, SimpleChestLock, Residence, ShowItem] +softdepend: [Vault, Reserve, LWC, Lockette, Deadbolt, OddItem, WorldGuard, GriefPrevention, RedProtect, Heroes, SimpleChestLock, Residence, ShowItem] api-version: '1.13' commands: