Fix Particle Effects in Minecraft 1.10
This commit is contained in:
parent
6da65053ae
commit
1439eef15d
@ -16,6 +16,7 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import com.massivecraft.massivecore.particleeffect.ReflectionUtils.PackageType;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import com.massivecraft.massivecore.util.ReflectionUtil;
|
||||
|
||||
/**
|
||||
* <b>ParticleEffect Library</b>
|
||||
@ -1388,7 +1389,7 @@ public enum ParticleEffect {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
version = Integer.parseInt(Character.toString(PackageType.getServerVersion().charAt(3)));
|
||||
version = ReflectionUtil.getVersionMinor();
|
||||
if (version > 7) {
|
||||
enumParticle = PackageType.MINECRAFT_SERVER.getClass("EnumParticle");
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.massivecraft.massivecore.predicate.Predicate;
|
||||
|
||||
public class ReflectionUtil
|
||||
@ -436,4 +438,31 @@ public class ReflectionUtil
|
||||
return new IllegalStateException(t.getClass().getSimpleName() + ": " + t.getMessage());
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// BUKKIT VERSION
|
||||
// -------------------------------------------- //
|
||||
|
||||
// Example: "v1_9_R4"
|
||||
private static String versionRaw = Bukkit.getServer().getClass().getPackage().getName().substring(23);
|
||||
public static String getVersionRaw() { return versionRaw; }
|
||||
|
||||
public static String getVersionRawPart(int index)
|
||||
{
|
||||
String versionRaw = getVersionRaw();
|
||||
String[] parts = versionRaw.split("_");
|
||||
return parts[index];
|
||||
}
|
||||
|
||||
// Example: 1
|
||||
private static int versionMajor = Integer.valueOf(getVersionRawPart(0).substring(1));
|
||||
public static int getVersionMajor() { return versionMajor; }
|
||||
|
||||
// Example: 9
|
||||
private static int versionMinor = Integer.valueOf(getVersionRawPart(1));
|
||||
public static int getVersionMinor() { return versionMinor; }
|
||||
|
||||
// Example: 4
|
||||
private static int versionRelease = Integer.valueOf(getVersionRawPart(2).substring(1));
|
||||
public static int getVersionRelease() { return versionRelease; }
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user