More of his fixes
This commit is contained in:
parent
ffcf4fd282
commit
e1c410781a
@ -17,7 +17,9 @@ import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
|
|||||||
import me.libraryaddict.disguise.utilities.sounds.SoundGroup;
|
import me.libraryaddict.disguise.utilities.sounds.SoundGroup;
|
||||||
import me.libraryaddict.disguise.utilities.sounds.SoundGroup.SoundType;
|
import me.libraryaddict.disguise.utilities.sounds.SoundGroup.SoundType;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -39,11 +41,9 @@ public class PacketListenerSounds extends PacketAdapter {
|
|||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.isAsync()) {
|
if (event.isAsync()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getPlayer().getName().contains("UNKNOWN[")) {
|
if (event.getPlayer().getName().contains("UNKNOWN[")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -147,32 +147,11 @@ public class PacketListenerSounds extends PacketAdapter {
|
|||||||
volume = disguiseSound.getDamageAndIdleSoundVolume();
|
volume = disguiseSound.getDamageAndIdleSoundVolume();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Here I assume its the default pitch as I can't calculate if its real.
|
|
||||||
if (disguise instanceof MobDisguise && disguisedEntity instanceof LivingEntity && ((MobDisguise) disguise).doesDisguiseAge()) {
|
if (disguise instanceof MobDisguise && disguisedEntity instanceof LivingEntity && ((MobDisguise) disguise).doesDisguiseAge()) {
|
||||||
boolean baby = false;
|
if (((MobDisguise) disguise).isAdult()) {
|
||||||
|
pitch = (DisguiseUtilities.random.nextFloat() - DisguiseUtilities.random.nextFloat()) * 0.2F + 1.0F;
|
||||||
if (disguisedEntity instanceof Zombie) {
|
} else {
|
||||||
baby = ((Zombie) disguisedEntity).isBaby();
|
pitch = (DisguiseUtilities.random.nextFloat() - DisguiseUtilities.random.nextFloat()) * 0.2F + 1.4F;
|
||||||
} else if (disguisedEntity instanceof Ageable) {
|
|
||||||
baby = !((Ageable) disguisedEntity).isAdult();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (((MobDisguise) disguise).isAdult() == baby) {
|
|
||||||
if (baby) {
|
|
||||||
// If the pitch is not the expected
|
|
||||||
if (pitch < 1.5 || pitch > 1.7) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pitch = (DisguiseUtilities.random.nextFloat() - DisguiseUtilities.random.nextFloat()) * 0.2F + 1.5F;
|
|
||||||
} else {
|
|
||||||
// If the pitch is not the expected
|
|
||||||
if (pitch < 1 || pitch > 1.2) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pitch = (DisguiseUtilities.random.nextFloat() - DisguiseUtilities.random.nextFloat()) * 0.2F + 1.0F;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,6 +228,7 @@ public class PacketListenerSounds extends PacketAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (disSound.getSound(soundType) != null) {
|
if (disSound.getSound(soundType) != null) {
|
||||||
|
|
||||||
disSound = SoundGroup.getGroup(disguise);
|
disSound = SoundGroup.getGroup(disguise);
|
||||||
|
|
||||||
if (disSound != null) {
|
if (disSound != null) {
|
||||||
@ -271,7 +251,7 @@ public class PacketListenerSounds extends PacketAdapter {
|
|||||||
float pitch;
|
float pitch;
|
||||||
|
|
||||||
if (disguise instanceof MobDisguise && !((MobDisguise) disguise).isAdult()) {
|
if (disguise instanceof MobDisguise && !((MobDisguise) disguise).isAdult()) {
|
||||||
pitch = (DisguiseUtilities.random.nextFloat() - DisguiseUtilities.random.nextFloat()) * 0.2F + 1.5F;
|
pitch = (DisguiseUtilities.random.nextFloat() - DisguiseUtilities.random.nextFloat()) * 0.2F + 1.4F;
|
||||||
} else {
|
} else {
|
||||||
pitch = (DisguiseUtilities.random.nextFloat() - DisguiseUtilities.random.nextFloat()) * 0.2F + 1.0F;
|
pitch = (DisguiseUtilities.random.nextFloat() - DisguiseUtilities.random.nextFloat()) * 0.2F + 1.0F;
|
||||||
}
|
}
|
||||||
@ -293,4 +273,3 @@ public class PacketListenerSounds extends PacketAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user