Merge branch 'sounds' of https://github.com/JBYoshi/LibsDisguises into JBYoshi-sounds
# Conflicts: # src/me/libraryaddict/disguise/utilities/DisguiseSound.java # src/me/libraryaddict/disguise/utilities/PacketsManager.java # src/me/libraryaddict/disguise/utilities/ReflectionManager.java
This commit is contained in:
commit
f14dec9b43
@ -133,7 +133,6 @@ public enum DisguiseSound
|
||||
|
||||
public static DisguiseSound getType(String name)
|
||||
{
|
||||
// TODO: FIX the disguise sounds
|
||||
try
|
||||
{
|
||||
return valueOf(name);
|
||||
|
@ -844,6 +844,7 @@ public class PacketsManager
|
||||
|
||||
mods.write(0, ReflectionManager.getNmsMethod(step.getClass(), "getStepSound")
|
||||
.invoke(step));
|
||||
mods.write(1, ReflectionManager.getSoundCategory(disguise.getType()));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -857,6 +858,7 @@ public class PacketsManager
|
||||
else
|
||||
{
|
||||
mods.write(0, ReflectionManager.getCraftSoundEffect(sound));
|
||||
mods.write(1, ReflectionManager.getSoundCategory(disguise.getType()));
|
||||
|
||||
// Time to change the pitch and volume
|
||||
if (soundType == SoundType.HURT || soundType == SoundType.DEATH
|
||||
@ -1006,7 +1008,7 @@ public class PacketsManager
|
||||
Object craftSoundEffect = ReflectionManager.getCraftSoundEffect(sound);
|
||||
|
||||
mods.write(0, craftSoundEffect);
|
||||
mods.write(1, ReflectionManager.getSoundCategory("master")); // Meh
|
||||
mods.write(1, ReflectionManager.getSoundCategory(disguise.getType())); // Meh
|
||||
mods.write(2, (int) (loc.getX() * 8D));
|
||||
mods.write(3, (int) (loc.getY() * 8D));
|
||||
mods.write(4, (int) (loc.getZ() * 8D));
|
||||
@ -1598,15 +1600,15 @@ public class PacketsManager
|
||||
|
||||
public static void setHearDisguisesListener(boolean enabled)
|
||||
{
|
||||
// TODO: FIX SOUNDS
|
||||
// if (soundsListenerEnabled != enabled) {
|
||||
// soundsListenerEnabled = enabled;
|
||||
// if (soundsListenerEnabled) {
|
||||
// ProtocolLibrary.getProtocolManager().addPacketListener(soundsListener);
|
||||
// } else {
|
||||
// ProtocolLibrary.getProtocolManager().removePacketListener(soundsListener);
|
||||
// }
|
||||
// }
|
||||
if (soundsListenerEnabled != enabled) {
|
||||
soundsListenerEnabled = enabled;
|
||||
|
||||
if (soundsListenerEnabled){
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(soundsListener);
|
||||
} else {
|
||||
ProtocolLibrary.getProtocolManager().removePacketListener(soundsListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void setInventoryListenerEnabled(boolean enabled)
|
||||
|
@ -31,6 +31,8 @@ import com.comphenix.protocol.wrappers.WrappedDataWatcher.WrappedDataWatcherObje
|
||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import org.bukkit.entity.*;
|
||||
|
||||
public class ReflectionManager
|
||||
{
|
||||
@ -770,10 +772,12 @@ public class ReflectionManager
|
||||
|
||||
for (Enum anEnum : enums != null ? enums : new Enum[0])
|
||||
{
|
||||
if (anEnum.name().equals("MASTER"))
|
||||
if (anEnum.name().equals(category.toUpperCase()))
|
||||
return anEnum;
|
||||
}
|
||||
}
|
||||
|
||||
return invoke;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -783,6 +787,22 @@ public class ReflectionManager
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Enum getSoundCategory(DisguiseType disguiseType)
|
||||
{
|
||||
if (disguiseType == DisguiseType.PLAYER)
|
||||
return getSoundCategory("player");
|
||||
|
||||
Class<? extends Entity> entityClass = disguiseType.getEntityType().getEntityClass();
|
||||
|
||||
if (Monster.class.isAssignableFrom(entityClass))
|
||||
return getSoundCategory("hostile");
|
||||
|
||||
if (Ambient.class.isAssignableFrom(entityClass))
|
||||
return getSoundCategory("ambient");
|
||||
|
||||
return getSoundCategory("neutral");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the NMS object EnumItemSlot from an EquipmentSlot.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user