Temporary patch for sounds not working

Replaced some code with Craftbukkit versions
This commit is contained in:
NavidK0
2016-03-06 03:38:14 -05:00
parent 99daf8246d
commit c972d02113
3 changed files with 254 additions and 249 deletions

View File

@@ -1,5 +1,6 @@
package me.libraryaddict.disguise.utilities;
import com.comphenix.protocol.wrappers.MinecraftKey;
import com.comphenix.protocol.wrappers.WrappedDataWatcher.Registry;
import com.comphenix.protocol.wrappers.WrappedDataWatcher.Serializer;
import com.comphenix.protocol.wrappers.WrappedDataWatcher.WrappedDataWatcherObject;
@@ -569,6 +570,32 @@ public class ReflectionManager {
}
}
/**
* Necessary for 1.9
* @return
*/
public static String convertSoundEffectToString(Object soundEffect) {
try {
Field f_getMinecraftKey = getNmsField("SoundEffect", "b");
f_getMinecraftKey.setAccessible(true);
MinecraftKey key = MinecraftKey.fromHandle(f_getMinecraftKey.get(soundEffect));
return key.getKey();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return null;
}
public static Object getCraftSoundEffect(String sound) {
Method nmsMethod = getNmsMethod("CraftSound", "getSoundEffect");
try {
return nmsMethod.invoke(null, sound);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
return null;
}
/**
* This creates a DataWatcherItem usable with WrappedWatchableObject
* @param id