diff --git a/src/main/java/com/massivecraft/factions/integration/lockette/EngineLockette.java b/src/main/java/com/massivecraft/factions/integration/lockette/EngineLockette.java index d18c4880..fe54998c 100644 --- a/src/main/java/com/massivecraft/factions/integration/lockette/EngineLockette.java +++ b/src/main/java/com/massivecraft/factions/integration/lockette/EngineLockette.java @@ -8,7 +8,8 @@ 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 me.crafter.mc.lockettepro.LocketteProAPI; +import org.bukkit.block.Block; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockBreakEvent; @@ -27,33 +28,22 @@ public class EngineLockette extends Engine { @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]")) { + Block block = event.getBlock(); + // Check if we are dealing with a protection sign, and overriding is enabled + if (!event.isCancelled() || (!LocketteProAPI.isLockSign(block) && !LocketteProAPI.isAdditionalSign(block)) || + !MConf.get().locketteLeaderRemoveOverride) { return; } // If in wilderness, don't allow any overrides - PS ps = PS.valueOf(event.getBlock()); + PS ps = PS.valueOf(block); Faction hostFaction = BoardColl.get().getFactionAt(ps); if (hostFaction.isNone()) { return; } MPlayer player = MPlayer.get(event.getPlayer()); - MPerm perm = ProtectCase.BUILD.getPerm(event.getBlock()); + MPerm perm = ProtectCase.BUILD.getPerm(block); // Only allow if the player is the leader of the faction the sign is in if (player.getFaction() != hostFaction || !player.getRank().isLeader()) {