diff --git a/README.md b/README.md index c02c85a..05828fd 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,8 @@ permanently by another cause, when they expire. - language - The language used for the plugin (en, nb-no) - perWorldPermissions - Sets permissions for the current world instead of setting them globally +- removePermissionSignIfMissing - If enabled, permission signs that have lost their physical sign will be removed during + startup. This prevents permission signs from staying in a broken state until the sign is replaced. - enableIndirectSignProtection - Protects permission signs against indirect sources such as pistons and explosions. Only disable this if your permission signs are protected by another plugin. - enableExtensiveSignProtection - Whether to protect signs on "unstable" blocks such as sand or anvils. Does not protect diff --git a/src/main/java/net/knarcraft/permissionsigns/PermissionSigns.java b/src/main/java/net/knarcraft/permissionsigns/PermissionSigns.java index c3b1c45..c630a0e 100644 --- a/src/main/java/net/knarcraft/permissionsigns/PermissionSigns.java +++ b/src/main/java/net/knarcraft/permissionsigns/PermissionSigns.java @@ -45,6 +45,7 @@ public final class PermissionSigns extends JavaPlugin { private static boolean perWorldPermissions; private static boolean enableExtensiveSignProtection; private static boolean enableIndirectSignProtection; + private static boolean removePermissionSignIfMissing; /** * Instantiates the permission signs class @@ -141,6 +142,15 @@ public final class PermissionSigns extends JavaPlugin { return enableIndirectSignProtection; } + /** + * Gets whether to remove permissions signs if their physical signs are missing + * + * @return
Whether tor remove permission signs if their signs are missing
+ */ + public static boolean removePermissionSignIfMissing() { + return removePermissionSignIfMissing; + } + @Override public void reloadConfig() { super.reloadConfig(); @@ -183,6 +193,7 @@ public final class PermissionSigns extends JavaPlugin { perWorldPermissions = config.getBoolean("perWorldPermissions", false); enableExtensiveSignProtection = config.getBoolean("enableExtensiveSignProtection", false); enableIndirectSignProtection = config.getBoolean("enableIndirectSignProtection", true); + removePermissionSignIfMissing = config.getBoolean("removePermissionSignIfMissing", true); saveConfig(); return language; } diff --git a/src/main/java/net/knarcraft/permissionsigns/manager/SignManager.java b/src/main/java/net/knarcraft/permissionsigns/manager/SignManager.java index e1fa5f2..14cc854 100644 --- a/src/main/java/net/knarcraft/permissionsigns/manager/SignManager.java +++ b/src/main/java/net/knarcraft/permissionsigns/manager/SignManager.java @@ -31,7 +31,7 @@ public final class SignManager { private static final File signsFile = new File(PermissionSigns.getInstance().getDataFolder(), "data.yml"); private SignManager() { - + } /** @@ -114,11 +114,15 @@ public final class SignManager { */ private static void redrawSigns() { Bukkit.getScheduler().scheduleSyncDelayedTask(PermissionSigns.getInstance(), () -> { + List