Fixed disguiseNextEntity
This commit is contained in:
parent
1d9d420c81
commit
7f65d8c8f1
@ -70,10 +70,6 @@ public class PacketHandlerSpawn implements IPacketHandler {
|
|||||||
private void constructSpawnPackets(final Player observer, LibsPackets packets, Entity disguisedEntity) {
|
private void constructSpawnPackets(final Player observer, LibsPackets packets, Entity disguisedEntity) {
|
||||||
Disguise disguise = packets.getDisguise();
|
Disguise disguise = packets.getDisguise();
|
||||||
|
|
||||||
if (disguise.getEntity() == null) {
|
|
||||||
disguise.setEntity(disguisedEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DisguiseConfig.isMiscDisguisesForLivingEnabled()) {
|
if (DisguiseConfig.isMiscDisguisesForLivingEnabled()) {
|
||||||
if (disguise.getWatcher() instanceof LivingWatcher) {
|
if (disguise.getWatcher() instanceof LivingWatcher) {
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import me.libraryaddict.disguise.disguisetypes.Disguise;
|
|||||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||||
import me.libraryaddict.disguise.utilities.packets.LibsPackets;
|
import me.libraryaddict.disguise.utilities.packets.LibsPackets;
|
||||||
import me.libraryaddict.disguise.utilities.packets.PacketsManager;
|
import me.libraryaddict.disguise.utilities.packets.PacketsManager;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
@ -38,10 +39,25 @@ public class PacketListenerMain extends PacketAdapter {
|
|||||||
|
|
||||||
final Disguise disguise = DisguiseUtilities.getDisguise(observer, entityId);
|
final Disguise disguise = DisguiseUtilities.getDisguise(observer, entityId);
|
||||||
|
|
||||||
|
if (disguise == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (disguise.getEntity() == null) {
|
||||||
|
for (Entity e : observer.getWorld().getEntities()) {
|
||||||
|
if (e.getEntityId() != entityId) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
disguise.setEntity(e);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If the entity is the same as the sender. Don't disguise!
|
// If the entity is the same as the sender. Don't disguise!
|
||||||
// Prevents problems and there is no advantage to be gained.
|
// Prevents problems and there is no advantage to be gained.
|
||||||
// Or if they are null and there's no disguise
|
// Or if they are null and there's no disguise
|
||||||
if (disguise == null || disguise.getEntity() == observer) {
|
if (disguise.getEntity() == observer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public class PacketListenerSounds extends PacketAdapter {
|
|||||||
for (TargetedDisguise entityDisguise : disguises) {
|
for (TargetedDisguise entityDisguise : disguises) {
|
||||||
Entity entity = entityDisguise.getEntity();
|
Entity entity = entityDisguise.getEntity();
|
||||||
|
|
||||||
if (entity.getWorld() != observer.getWorld()) {
|
if (entity == null || entity.getWorld() != observer.getWorld()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user