mirror of
https://github.com/TotalFreedomMC/TF-WorldGuardExtraFlagsPlugin.git
synced 2024-12-28 10:04:50 +00:00
Fixed materials looking up legacy ones first on 1.13
This commit is contained in:
parent
592ef42741
commit
2eaba09e0b
4 changed files with 26 additions and 2 deletions
|
@ -87,6 +87,7 @@
|
||||||
<groupId>com.comphenix.protocol</groupId>
|
<groupId>com.comphenix.protocol</groupId>
|
||||||
<artifactId>ProtocolLib-API</artifactId>
|
<artifactId>ProtocolLib-API</artifactId>
|
||||||
<version>4.4.0</version>
|
<version>4.4.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
|
@ -1,8 +1,12 @@
|
||||||
name: WorldGuardExtraFlags
|
name: WorldGuardExtraFlags
|
||||||
version: 4.1.2-DEV
|
|
||||||
description: Adds more flags to WorldGuard to help manage your server easily!
|
description: Adds more flags to WorldGuard to help manage your server easily!
|
||||||
|
|
||||||
|
version: 4.1.2-DEV
|
||||||
|
api-version: 1.13
|
||||||
|
|
||||||
author: isokissa3
|
author: isokissa3
|
||||||
website: https://goldtreevers.net
|
website: https://goldtreevers.net
|
||||||
|
|
||||||
depend: [ WorldGuard ]
|
depend: [ WorldGuard ]
|
||||||
softdepend: [ MythicMobs, FastAsyncWorldEdit, Essentials, ProtocolLib ]
|
softdepend: [ MythicMobs, FastAsyncWorldEdit, Essentials, ProtocolLib ]
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@ import com.sk89q.worldguard.protection.flags.Flag;
|
||||||
import com.sk89q.worldguard.protection.flags.FlagContext;
|
import com.sk89q.worldguard.protection.flags.FlagContext;
|
||||||
import com.sk89q.worldguard.protection.flags.InvalidFlagFormat;
|
import com.sk89q.worldguard.protection.flags.InvalidFlagFormat;
|
||||||
|
|
||||||
|
import net.goldtreeservers.worldguardextraflags.utils.SupportedFeatures;
|
||||||
|
|
||||||
public class MaterialFlag extends Flag<Material>
|
public class MaterialFlag extends Flag<Material>
|
||||||
{
|
{
|
||||||
public MaterialFlag(String name)
|
public MaterialFlag(String name)
|
||||||
|
@ -36,6 +38,12 @@ public class MaterialFlag extends Flag<Material>
|
||||||
@Override
|
@Override
|
||||||
public Material unmarshal(Object o)
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,14 @@ import lombok.Getter;
|
||||||
/**
|
/**
|
||||||
* Helper class to decide what features are supported by the server
|
* Helper class to decide what features are supported by the server
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class SupportedFeatures
|
public class SupportedFeatures
|
||||||
{
|
{
|
||||||
@Getter private static boolean frostwalkerSupported;
|
@Getter private static boolean frostwalkerSupported;
|
||||||
@Getter private static boolean stopSoundSupported;
|
@Getter private static boolean stopSoundSupported;
|
||||||
@Getter private static boolean potionEffectEventSupported;
|
@Getter private static boolean potionEffectEventSupported;
|
||||||
@Getter private static boolean potionEffectParticles;
|
@Getter private static boolean potionEffectParticles;
|
||||||
|
@Getter private static boolean newMaterial;
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
|
@ -53,5 +55,14 @@ public class SupportedFeatures
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SupportedFeatures.newMaterial = Material.LEGACY_AIR != null;
|
||||||
|
}
|
||||||
|
catch(Throwable ignored)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue