diff --git a/Common/pom.xml b/Common/pom.xml index 1124efc..c44e1f7 100644 --- a/Common/pom.xml +++ b/Common/pom.xml @@ -87,6 +87,7 @@ com.comphenix.protocol ProtocolLib-API 4.4.0 + provided \ No newline at end of file diff --git a/Spigot/src/main/resources/plugin.yml b/Spigot/src/main/resources/plugin.yml index 4b9393d..fb0e0dc 100644 --- a/Spigot/src/main/resources/plugin.yml +++ b/Spigot/src/main/resources/plugin.yml @@ -1,8 +1,12 @@ name: WorldGuardExtraFlags -version: 4.1.2-DEV description: Adds more flags to WorldGuard to help manage your server easily! + +version: 4.1.2-DEV +api-version: 1.13 + author: isokissa3 website: https://goldtreevers.net + depend: [ WorldGuard ] softdepend: [ MythicMobs, FastAsyncWorldEdit, Essentials, ProtocolLib ] diff --git a/WG/src/main/java/net/goldtreeservers/worldguardextraflags/flags/helpers/MaterialFlag.java b/WG/src/main/java/net/goldtreeservers/worldguardextraflags/flags/helpers/MaterialFlag.java index 11d618a..883818b 100644 --- a/WG/src/main/java/net/goldtreeservers/worldguardextraflags/flags/helpers/MaterialFlag.java +++ b/WG/src/main/java/net/goldtreeservers/worldguardextraflags/flags/helpers/MaterialFlag.java @@ -6,6 +6,8 @@ import com.sk89q.worldguard.protection.flags.Flag; import com.sk89q.worldguard.protection.flags.FlagContext; import com.sk89q.worldguard.protection.flags.InvalidFlagFormat; +import net.goldtreeservers.worldguardextraflags.utils.SupportedFeatures; + public class MaterialFlag extends Flag { public MaterialFlag(String name) @@ -36,6 +38,12 @@ public class MaterialFlag extends Flag @Override public Material unmarshal(Object o) { - return Material.matchMaterial(o.toString()); + Material material = Material.matchMaterial(o.toString()); + if (material == null && SupportedFeatures.isNewMaterial()) //Fallback to legacy on unmarshal only + { + material = Material.matchMaterial(o.toString(), true); + } + + return material; } } diff --git a/WG/src/main/java/net/goldtreeservers/worldguardextraflags/utils/SupportedFeatures.java b/WG/src/main/java/net/goldtreeservers/worldguardextraflags/utils/SupportedFeatures.java index 2a4f1f5..1ab5f13 100644 --- a/WG/src/main/java/net/goldtreeservers/worldguardextraflags/utils/SupportedFeatures.java +++ b/WG/src/main/java/net/goldtreeservers/worldguardextraflags/utils/SupportedFeatures.java @@ -12,12 +12,14 @@ import lombok.Getter; /** * Helper class to decide what features are supported by the server */ +@SuppressWarnings("deprecation") public class SupportedFeatures { @Getter private static boolean frostwalkerSupported; @Getter private static boolean stopSoundSupported; @Getter private static boolean potionEffectEventSupported; @Getter private static boolean potionEffectParticles; + @Getter private static boolean newMaterial; static { @@ -53,5 +55,14 @@ public class SupportedFeatures { } + + try + { + SupportedFeatures.newMaterial = Material.LEGACY_AIR != null; + } + catch(Throwable ignored) + { + + } } }