mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-12-01 14:33:21 +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>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>nl.rutgerkok</groupId>
|
||||||
|
<artifactId>blocklocker</artifactId>
|
||||||
|
<version>1.9</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.bekvon.bukkit</groupId>
|
<groupId>com.bekvon.bukkit</groupId>
|
||||||
<artifactId>residence</artifactId>
|
<artifactId>residence</artifactId>
|
||||||
|
@ -118,6 +118,9 @@ public class Dependencies implements Listener {
|
|||||||
case SimpleChestLock:
|
case SimpleChestLock:
|
||||||
listener = SimpleChestLock.getSimpleChestLock(plugin);
|
listener = SimpleChestLock.getSimpleChestLock(plugin);
|
||||||
break;
|
break;
|
||||||
|
case BlockLocker:
|
||||||
|
listener = new BlockLocker();
|
||||||
|
break;
|
||||||
case Residence:
|
case Residence:
|
||||||
if (plugin.getDescription().getVersion().startsWith("2")) {
|
if (plugin.getDescription().getVersion().startsWith("2")) {
|
||||||
ChestShop.getBukkitLogger().severe("You are using an old version of Residence! " +
|
ChestShop.getBukkitLogger().severe("You are using an old version of Residence! " +
|
||||||
@ -190,6 +193,7 @@ public class Dependencies implements Listener {
|
|||||||
LockettePro,
|
LockettePro,
|
||||||
Deadbolt,
|
Deadbolt,
|
||||||
SimpleChestLock,
|
SimpleChestLock,
|
||||||
|
BlockLocker,
|
||||||
Residence,
|
Residence,
|
||||||
|
|
||||||
WorldGuard,
|
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
|
author: Acrobot
|
||||||
authors: ['https://github.com/ChestShop-authors/ChestShop-3/contributors']
|
authors: ['https://github.com/ChestShop-authors/ChestShop-3/contributors']
|
||||||
description: A chest shop for economy plugins.
|
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'
|
api-version: '1.13'
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
Loading…
Reference in New Issue
Block a user