diff --git a/pom.xml b/pom.xml
index fcf2ba00..1c51a40c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -119,6 +119,11 @@
dynmap-api
3.1-beta-2
+
+ me.crafter.mc
+ lockettepro
+ 2.10-SNAPSHOT
+
diff --git a/src/main/java/com/massivecraft/factions/Factions.java b/src/main/java/com/massivecraft/factions/Factions.java
index 43fc36e1..a1e2c76c 100644
--- a/src/main/java/com/massivecraft/factions/Factions.java
+++ b/src/main/java/com/massivecraft/factions/Factions.java
@@ -68,6 +68,7 @@ import com.massivecraft.factions.entity.migrator.MigratorMPlayer002UsingAdminMod
import com.massivecraft.factions.entity.migrator.MigratorTerritoryAccess001Restructure;
import com.massivecraft.factions.event.EventFactionsChunkChangeType;
import com.massivecraft.factions.integration.dynmap.IntegrationDynmap;
+import com.massivecraft.factions.integration.lockette.IntegrationLockette;
import com.massivecraft.factions.integration.lwc.IntegrationLwc;
import com.massivecraft.factions.integration.placeholderapi.IntegrationPlaceholderAPI;
import com.massivecraft.factions.integration.venturechat.IntegrationVentureChat;
@@ -205,6 +206,7 @@ public class Factions extends MassivePlugin {
IntegrationPlaceholderAPI.class,
IntegrationVentureChat.class,
IntegrationLwc.class,
+ IntegrationLockette.class,
IntegrationWorldGuard.class,
IntegrationDynmap.class
);
diff --git a/src/main/java/com/massivecraft/factions/entity/MConf.java b/src/main/java/com/massivecraft/factions/entity/MConf.java
index 50b16bdd..c609eabe 100644
--- a/src/main/java/com/massivecraft/factions/entity/MConf.java
+++ b/src/main/java/com/massivecraft/factions/entity/MConf.java
@@ -651,6 +651,13 @@ public class MConf extends Entity {
EventFactionsChunkChangeType.PILLAGE, false // when unclaiming (to wilderness) from another player faction
);
+ // -------------------------------------------- //
+ // INTEGRATION: LockettePro
+ // -------------------------------------------- //
+
+ // Whether a leader of a faction can remove a lockette sign in their faction, regardless of the actual owner
+ public boolean locketteLeaderRemoveOverride = true;
+
// -------------------------------------------- //
// INTEGRATION: WorldGuard
// -------------------------------------------- //
diff --git a/src/main/java/com/massivecraft/factions/integration/lockette/EngineLockette.java b/src/main/java/com/massivecraft/factions/integration/lockette/EngineLockette.java
new file mode 100644
index 00000000..d18c4880
--- /dev/null
+++ b/src/main/java/com/massivecraft/factions/integration/lockette/EngineLockette.java
@@ -0,0 +1,69 @@
+package com.massivecraft.factions.integration.lockette;
+
+import com.massivecraft.factions.engine.ProtectCase;
+import com.massivecraft.factions.entity.BoardColl;
+import com.massivecraft.factions.entity.Faction;
+import com.massivecraft.factions.entity.MConf;
+import com.massivecraft.factions.entity.MPerm;
+import com.massivecraft.factions.entity.MPlayer;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.ps.PS;
+import org.bukkit.block.Sign;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.block.BlockBreakEvent;
+
+public class EngineLockette extends Engine {
+
+ // -------------------------------------------- //
+ // INSTANCE & CONSTRUCT
+ // -------------------------------------------- //
+
+ private static EngineLockette i = new EngineLockette();
+
+ public static EngineLockette get() {
+ return i;
+ }
+
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void onLocketteBreak(BlockBreakEvent event) {
+ if (!event.isCancelled() || !(event.getBlock().getState() instanceof Sign)) {
+ return;
+ }
+
+ // If disabled, do nothing
+ if (!MConf.get().locketteLeaderRemoveOverride) {
+ return;
+ }
+
+ // Check if we are dealing with a protection sign
+ String firstLine = ((Sign) event.getBlock().getState()).getLine(0);
+ if (firstLine.contains("#")) {
+ firstLine = firstLine.split("#", 2)[0];
+ }
+ if (!firstLine.equalsIgnoreCase("[Private]")) {
+ return;
+ }
+
+ // If in wilderness, don't allow any overrides
+ PS ps = PS.valueOf(event.getBlock());
+ Faction hostFaction = BoardColl.get().getFactionAt(ps);
+ if (hostFaction.isNone()) {
+ return;
+ }
+
+ MPlayer player = MPlayer.get(event.getPlayer());
+ MPerm perm = ProtectCase.BUILD.getPerm(event.getBlock());
+
+ // Only allow if the player is the leader of the faction the sign is in
+ if (player.getFaction() != hostFaction || !player.getRank().isLeader()) {
+ return;
+ }
+
+ // Require build permissions to remove the lockette sign
+ if (perm != null && perm.has(player, ps, false)) {
+ event.setCancelled(false);
+ }
+ }
+
+}
diff --git a/src/main/java/com/massivecraft/factions/integration/lockette/IntegrationLockette.java b/src/main/java/com/massivecraft/factions/integration/lockette/IntegrationLockette.java
new file mode 100644
index 00000000..122a66a4
--- /dev/null
+++ b/src/main/java/com/massivecraft/factions/integration/lockette/IntegrationLockette.java
@@ -0,0 +1,30 @@
+package com.massivecraft.factions.integration.lockette;
+
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.Integration;
+
+public class IntegrationLockette extends Integration {
+ // -------------------------------------------- //
+ // INSTANCE & CONSTRUCT
+ // -------------------------------------------- //
+
+ private static IntegrationLockette i = new IntegrationLockette();
+
+ public static IntegrationLockette get() {
+ return i;
+ }
+
+ private IntegrationLockette() {
+ this.setPluginName("LockettePro");
+ }
+
+ // -------------------------------------------- //
+ // OVERRIDE
+ // -------------------------------------------- //
+
+ @Override
+ public Engine getEngine() {
+ return EngineLockette.get();
+ }
+
+}