mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-12-02 23:13:21 +01:00
Turn off internal protection for more protection plugins (Resolves #442)
This expands the TURN_OFF_DEFAULT_PROTECTION_WHEN_PROTECTED_EXTERNALLY config option so that it applies to more protection plugins rather than just LWC. Currently supported: BlockLocker, Deadbolt, Lockette (1.x), LockettePro (2.x) and SimpleChestLock
This commit is contained in:
parent
07a22fa534
commit
b8899c8333
@ -1,5 +1,6 @@
|
|||||||
package com.Acrobot.ChestShop.Plugins;
|
package com.Acrobot.ChestShop.Plugins;
|
||||||
|
|
||||||
|
import com.Acrobot.ChestShop.Configuration.Properties;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -22,8 +23,14 @@ public class BlockLocker implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
if (BlockLockerAPIv2.isProtected(block) && !BlockLockerAPIv2.isOwner(event.getPlayer(), block)) {
|
if (!BlockLockerAPIv2.isProtected(block)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!BlockLockerAPIv2.isOwner(event.getPlayer(), block)) {
|
||||||
event.setResult(Event.Result.DENY);
|
event.setResult(Event.Result.DENY);
|
||||||
|
} else if (Properties.TURN_OFF_DEFAULT_PROTECTION_WHEN_PROTECTED_EXTERNALLY) {
|
||||||
|
event.setResult(Event.Result.ALLOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.Acrobot.ChestShop.Plugins;
|
package com.Acrobot.ChestShop.Plugins;
|
||||||
|
|
||||||
|
import com.Acrobot.ChestShop.Configuration.Properties;
|
||||||
import com.Acrobot.ChestShop.Events.Protection.ProtectionCheckEvent;
|
import com.Acrobot.ChestShop.Events.Protection.ProtectionCheckEvent;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -26,6 +27,8 @@ public class Deadbolt implements Listener {
|
|||||||
|
|
||||||
if (!com.daemitus.deadbolt.Deadbolt.isAuthorized(player, block)) {
|
if (!com.daemitus.deadbolt.Deadbolt.isAuthorized(player, block)) {
|
||||||
event.setResult(Event.Result.DENY);
|
event.setResult(Event.Result.DENY);
|
||||||
|
} else if (Properties.TURN_OFF_DEFAULT_PROTECTION_WHEN_PROTECTED_EXTERNALLY) {
|
||||||
|
event.setResult(Event.Result.ALLOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package com.Acrobot.ChestShop.Plugins;
|
package com.Acrobot.ChestShop.Plugins;
|
||||||
|
|
||||||
import com.Acrobot.Breeze.Utils.NameUtil;
|
import com.Acrobot.ChestShop.Configuration.Properties;
|
||||||
import com.Acrobot.ChestShop.Database.Account;
|
|
||||||
import com.Acrobot.ChestShop.Events.Protection.ProtectionCheckEvent;
|
import com.Acrobot.ChestShop.Events.Protection.ProtectionCheckEvent;
|
||||||
import com.Acrobot.ChestShop.UUIDs.NameManager;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
@ -27,9 +25,10 @@ public class Lockette implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Account account = NameManager.getAccount(player.getUniqueId());
|
if (!org.yi.acru.bukkit.Lockette.Lockette.isUser(block, player, true)) {
|
||||||
if (account != null && !org.yi.acru.bukkit.Lockette.Lockette.isUser(block, account.getName(), true)) {
|
|
||||||
event.setResult(Event.Result.DENY);
|
event.setResult(Event.Result.DENY);
|
||||||
|
} else if (Properties.TURN_OFF_DEFAULT_PROTECTION_WHEN_PROTECTED_EXTERNALLY) {
|
||||||
|
event.setResult(Event.Result.ALLOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.Acrobot.ChestShop.Plugins;
|
package com.Acrobot.ChestShop.Plugins;
|
||||||
|
|
||||||
|
import com.Acrobot.ChestShop.Configuration.Properties;
|
||||||
import com.Acrobot.ChestShop.Events.Protection.ProtectionCheckEvent;
|
import com.Acrobot.ChestShop.Events.Protection.ProtectionCheckEvent;
|
||||||
import me.crafter.mc.lockettepro.LocketteProAPI;
|
import me.crafter.mc.lockettepro.LocketteProAPI;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -19,12 +20,14 @@ public class LockettePro implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
|
|
||||||
if (!LocketteProAPI.isProtected(block)) {
|
if (!LocketteProAPI.isProtected(block) && !LocketteProAPI.isLocked(block)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LocketteProAPI.isLocked(block) && !LocketteProAPI.isOwner(block, player)) {
|
if (!LocketteProAPI.isUser(block, player)) {
|
||||||
event.setResult(Event.Result.DENY);
|
event.setResult(Event.Result.DENY);
|
||||||
|
} else if (Properties.TURN_OFF_DEFAULT_PROTECTION_WHEN_PROTECTED_EXTERNALLY) {
|
||||||
|
event.setResult(Event.Result.ALLOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.Acrobot.ChestShop.Plugins;
|
package com.Acrobot.ChestShop.Plugins;
|
||||||
|
|
||||||
|
import com.Acrobot.ChestShop.Configuration.Properties;
|
||||||
import com.Acrobot.ChestShop.Events.Protection.ProtectionCheckEvent;
|
import com.Acrobot.ChestShop.Events.Protection.ProtectionCheckEvent;
|
||||||
import com.webkonsept.bukkit.simplechestlock.SCL;
|
import com.webkonsept.bukkit.simplechestlock.SCL;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -36,6 +37,8 @@ public class SimpleChestLock implements Listener {
|
|||||||
|
|
||||||
if (!scl.chests.getOwner(block).equals(playerName)) {
|
if (!scl.chests.getOwner(block).equals(playerName)) {
|
||||||
event.setResult(Event.Result.DENY);
|
event.setResult(Event.Result.DENY);
|
||||||
|
} else if (Properties.TURN_OFF_DEFAULT_PROTECTION_WHEN_PROTECTED_EXTERNALLY) {
|
||||||
|
event.setResult(Event.Result.ALLOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user