diff --git a/pom.xml b/pom.xml
index f24e50e..0e912fc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -53,6 +53,10 @@
jitpack.io
https://jitpack.io
+
+ NyaaCat
+ https://ci.nyaacat.com/maven/
+
@@ -318,6 +322,13 @@
0.1.0.10
provided
+
+
+ me.crafter.mc
+ lockettepro
+ 2.10-SNAPSHOT
+ provided
+
diff --git a/src/main/java/com/Acrobot/ChestShop/ChestShop.java b/src/main/java/com/Acrobot/ChestShop/ChestShop.java
index e942413..54c7a06 100644
--- a/src/main/java/com/Acrobot/ChestShop/ChestShop.java
+++ b/src/main/java/com/Acrobot/ChestShop/ChestShop.java
@@ -299,6 +299,8 @@ public class ChestShop extends JavaPlugin {
private void registerEvents() {
registerEvent(new com.Acrobot.ChestShop.Plugins.ChestShop()); //Chest protection
+ registerEvent(new Dependencies());
+
registerEvent(new NameManager());
registerPreShopCreationEvents();
diff --git a/src/main/java/com/Acrobot/ChestShop/Dependencies.java b/src/main/java/com/Acrobot/ChestShop/Dependencies.java
index 4592ddd..2e1b17b 100644
--- a/src/main/java/com/Acrobot/ChestShop/Dependencies.java
+++ b/src/main/java/com/Acrobot/ChestShop/Dependencies.java
@@ -6,7 +6,10 @@ import com.Acrobot.ChestShop.Listeners.Economy.Plugins.ReserveListener;
import com.Acrobot.ChestShop.Listeners.Economy.Plugins.VaultListener;
import com.Acrobot.ChestShop.Plugins.*;
import org.bukkit.Bukkit;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
+import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager;
@@ -14,7 +17,7 @@ import org.bukkit.plugin.PluginManager;
/**
* @author Acrobot
*/
-public class Dependencies {
+public class Dependencies implements Listener {
public static void initializePlugins() {
PluginManager pluginManager = Bukkit.getPluginManager();
@@ -106,6 +109,9 @@ public class Dependencies {
case Lockette:
listener = new Lockette();
break;
+ case LockettePro:
+ listener = new LockettePro();
+ break;
case Deadbolt:
listener = new Deadbolt();
break;
@@ -184,6 +190,7 @@ public class Dependencies {
private static enum Dependency {
LWC,
Lockette,
+ LockettePro,
Deadbolt,
SimpleChestLock,
Residence,
@@ -198,4 +205,12 @@ public class Dependencies {
ShowItem
}
+
+ @EventHandler(priority = EventPriority.MONITOR)
+ public void onEnable(PluginEnableEvent event) {
+ Plugin plugin = event.getPlugin();
+ if (ChestShop.getDependencies().contains(plugin.getName())) {
+ loadPlugin(plugin.getName(), plugin);
+ }
+ }
}
diff --git a/src/main/java/com/Acrobot/ChestShop/Listeners/Player/PlayerInteract.java b/src/main/java/com/Acrobot/ChestShop/Listeners/Player/PlayerInteract.java
index 34a022d..6bc7561 100644
--- a/src/main/java/com/Acrobot/ChestShop/Listeners/Player/PlayerInteract.java
+++ b/src/main/java/com/Acrobot/ChestShop/Listeners/Player/PlayerInteract.java
@@ -20,6 +20,7 @@ import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.block.Block;
+import org.bukkit.block.BlockState;
import org.bukkit.block.Container;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
@@ -277,6 +278,10 @@ public class PlayerInteract implements Listener {
if (!Security.canAccess(player, signBlock)) {
return;
}
+
+ if (!Security.canAccess(player, container.getBlock())) {
+ return;
+ }
BlockUtil.openBlockGUI(container, player);
}
diff --git a/src/main/java/com/Acrobot/ChestShop/Plugins/LockettePro.java b/src/main/java/com/Acrobot/ChestShop/Plugins/LockettePro.java
new file mode 100644
index 0000000..b64840c
--- /dev/null
+++ b/src/main/java/com/Acrobot/ChestShop/Plugins/LockettePro.java
@@ -0,0 +1,30 @@
+package com.Acrobot.ChestShop.Plugins;
+
+import com.Acrobot.ChestShop.Events.Protection.ProtectionCheckEvent;
+import me.crafter.mc.lockettepro.LocketteProAPI;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Event;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+
+public class LockettePro implements Listener {
+
+ @EventHandler
+ public static void onProtectionCheck(ProtectionCheckEvent event) {
+ if (event.getResult() == Event.Result.DENY) {
+ return;
+ }
+
+ Player player = event.getPlayer();
+ Block block = event.getBlock();
+
+ if (!LocketteProAPI.isProtected(block)) {
+ return;
+ }
+
+ if (LocketteProAPI.isLocked(block) && !LocketteProAPI.isOwner(block, player)) {
+ event.setResult(Event.Result.DENY);
+ }
+ }
+}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index cb473a9..7aa3610 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, RedProtect, Heroes, SimpleChestLock, Residence, ShowItem]
+softdepend: [Vault, Reserve, LWC, Lockette, LockettePro, Deadbolt, OddItem, WorldGuard, GriefPrevention, RedProtect, Heroes, SimpleChestLock, Residence, ShowItem]
api-version: '1.13'
commands: