mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-25 19:45:36 +01:00
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:
parent
aadfaff397
commit
e6b05ff982
7
pom.xml
7
pom.xml
@ -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>
|
||||
|
@ -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,
|
||||
|
29
src/main/java/com/Acrobot/ChestShop/Plugins/BlockLocker.java
Normal file
29
src/main/java/com/Acrobot/ChestShop/Plugins/BlockLocker.java
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user