Init reflection after version check

This commit is contained in:
libraryaddict 2019-12-24 17:40:56 +13:00
parent 4835b6de0b
commit dad91c1075
3 changed files with 15 additions and 12 deletions

View File

@ -68,6 +68,8 @@ public class LibsDisguises extends JavaPlugin {
return; return;
} }
ReflectionManager.init();
PacketsManager.init(this); PacketsManager.init(this);
DisguiseUtilities.init(this); DisguiseUtilities.init(this);

View File

@ -544,8 +544,9 @@ public class FlagWatcher {
public void setSneaking(boolean setSneaking) { public void setSneaking(boolean setSneaking) {
setEntityFlag(1, setSneaking); setEntityFlag(1, setSneaking);
updatePose();
sendData(MetaIndex.ENTITY_META); sendData(MetaIndex.ENTITY_META);
updatePose();
} }
public boolean isSleeping() { public boolean isSleeping() {

View File

@ -32,19 +32,19 @@ import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
public class ReflectionManager { public class ReflectionManager {
private static final String bukkitVersion = Bukkit.getServer().getClass().getName().split("\\.")[3]; private static String bukkitVersion = Bukkit.getServer().getClass().getName().split("\\.")[3];
private static final Class<?> craftItemClass; private static Class<?> craftItemClass;
private static Method damageAndIdleSoundMethod; private static Method damageAndIdleSoundMethod;
private static final Constructor<?> boundingBoxConstructor; private static Constructor<?> boundingBoxConstructor;
private static final Method setBoundingBoxMethod; private static Method setBoundingBoxMethod;
private static final Field pingField; private static Field pingField;
public static final Field entityCountField; public static Field entityCountField;
private static final Field chunkMapField; private static Field chunkMapField;
private static final Field chunkProviderField; private static Field chunkProviderField;
private static final Field entityTrackerField; private static Field entityTrackerField;
private static final Field trackedEntitiesField; private static Field trackedEntitiesField;
static { public static void init() {
try { try {
Object entity = createEntityInstance(DisguiseType.COW, "Cow"); Object entity = createEntityInstance(DisguiseType.COW, "Cow");