Add support for BlockLocker

It's no longer possible to open shops on chests that were protected by someone else.
This commit is contained in:
Rutger Kok 2021-02-28 18:10:33 +01:00 committed by Max Lee
parent aadfaff397
commit e6b05ff982
4 changed files with 41 additions and 1 deletions

View File

@ -295,6 +295,13 @@
</exclusions>
</dependency>
<dependency>
<groupId>nl.rutgerkok</groupId>
<artifactId>blocklocker</artifactId>
<version>1.9</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.bekvon.bukkit</groupId>
<artifactId>residence</artifactId>

View File

@ -118,6 +118,9 @@ public class Dependencies implements Listener {
case SimpleChestLock:
listener = SimpleChestLock.getSimpleChestLock(plugin);
break;
case BlockLocker:
listener = new BlockLocker();
break;
case Residence:
if (plugin.getDescription().getVersion().startsWith("2")) {
ChestShop.getBukkitLogger().severe("You are using an old version of Residence! " +
@ -190,6 +193,7 @@ public class Dependencies implements Listener {
LockettePro,
Deadbolt,
SimpleChestLock,
BlockLocker,
Residence,
WorldGuard,

View File

@ -0,0 +1,29 @@
package com.Acrobot.ChestShop.Plugins;
import org.bukkit.block.Block;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import com.Acrobot.ChestShop.Events.Protection.ProtectionCheckEvent;
import nl.rutgerkok.blocklocker.BlockLockerAPIv2;
/**
* @author Acrobot
*/
public class BlockLocker implements Listener {
@EventHandler
public void onProtectionCheck(ProtectionCheckEvent event) {
if (event.getResult() == Event.Result.DENY) {
return;
}
Block block = event.getBlock();
if (BlockLockerAPIv2.isProtected(block) && !BlockLockerAPIv2.isOwner(event.getPlayer(), block)) {
event.setResult(Event.Result.DENY);
}
}
}

View File

@ -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, LockettePro, Deadbolt, OddItem, WorldGuard, GriefPrevention, RedProtect, Heroes, SimpleChestLock, Residence, ShowItem]
softdepend: [Vault, Reserve, LWC, Lockette, LockettePro, Deadbolt, BlockLocker, OddItem, WorldGuard, GriefPrevention, RedProtect, Heroes, SimpleChestLock, Residence, ShowItem]
api-version: '1.13'
commands: