Fix turning off default protection if protected externally (Fixes #445)

This commit is contained in:
Phoenix616 2021-05-16 00:17:25 +01:00
parent d3ed650b74
commit 5b214e09f5
No known key found for this signature in database
GPG Key ID: 40E2321E71738EB0
6 changed files with 19 additions and 16 deletions

View File

@ -4,6 +4,7 @@ import com.Acrobot.ChestShop.Configuration.Properties;
import org.bukkit.block.Block;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import com.Acrobot.ChestShop.Events.Protection.ProtectionCheckEvent;
@ -14,11 +15,9 @@ import nl.rutgerkok.blocklocker.BlockLockerAPIv2;
* @author Acrobot
*/
public class BlockLocker implements Listener {
@EventHandler
@EventHandler(priority = EventPriority.HIGH)
public void onProtectionCheck(ProtectionCheckEvent event) {
if (event.getResult() == Event.Result.DENY) {
if (event.getResult() == Event.Result.DENY && !Properties.TURN_OFF_DEFAULT_PROTECTION_WHEN_PROTECTED_EXTERNALLY) {
return;
}

View File

@ -6,15 +6,16 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
/**
* @author Acrobot
*/
public class Deadbolt implements Listener {
@EventHandler
@EventHandler(priority = EventPriority.HIGH)
public static void onProtectionCheck(ProtectionCheckEvent event) {
if (event.getResult() == Event.Result.DENY) {
if (event.getResult() == Event.Result.DENY && !Properties.TURN_OFF_DEFAULT_PROTECTION_WHEN_PROTECTED_EXTERNALLY) {
return;
}

View File

@ -6,15 +6,16 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
/**
* @author Acrobot
*/
public class Lockette implements Listener {
@EventHandler
@EventHandler(priority = EventPriority.HIGH)
public static void onProtectionCheck(ProtectionCheckEvent event) {
if (event.getResult() == Event.Result.DENY) {
if (event.getResult() == Event.Result.DENY && !Properties.TURN_OFF_DEFAULT_PROTECTION_WHEN_PROTECTED_EXTERNALLY) {
return;
}

View File

@ -7,13 +7,13 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
public class LockettePro implements Listener {
@EventHandler
@EventHandler(priority = EventPriority.HIGH)
public static void onProtectionCheck(ProtectionCheckEvent event) {
if (event.getResult() == Event.Result.DENY) {
if (event.getResult() == Event.Result.DENY && !Properties.TURN_OFF_DEFAULT_PROTECTION_WHEN_PROTECTED_EXTERNALLY) {
return;
}

View File

@ -1,5 +1,6 @@
package com.Acrobot.ChestShop.Plugins;
import com.Acrobot.ChestShop.Configuration.Properties;
import com.Acrobot.ChestShop.Events.Protection.ProtectionCheckEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.api.ResidenceApi;
@ -9,6 +10,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
/**
@ -16,10 +18,9 @@ import org.bukkit.event.Listener;
* @author Andrzej Pomirski
*/
public class ResidenceChestProtection implements Listener {
@EventHandler
@EventHandler(priority = EventPriority.HIGH)
public static void onProtectionCheck(ProtectionCheckEvent event) {
if (event.getResult() == Event.Result.DENY) {
if (event.getResult() == Event.Result.DENY && !Properties.TURN_OFF_DEFAULT_PROTECTION_WHEN_PROTECTED_EXTERNALLY) {
return;
}

View File

@ -7,6 +7,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
@ -20,9 +21,9 @@ public class SimpleChestLock implements Listener {
this.scl = scl;
}
@EventHandler
@EventHandler(priority = EventPriority.HIGH)
public void onProtectionCheck(ProtectionCheckEvent event) {
if (event.getResult() == Event.Result.DENY) {
if (event.getResult() == Event.Result.DENY && !Properties.TURN_OFF_DEFAULT_PROTECTION_WHEN_PROTECTED_EXTERNALLY) {
return;
}