Temporary patch for sounds not working
Replaced some code with Craftbukkit versions
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user