Disguises: Fixed DisguisePlayer not using a random UUID to prevent conflicts, fixed non-player living entities not being disguisable

This commit is contained in:
libraryaddict 2015-04-04 17:33:33 +13:00
parent 66c83397e5
commit c1c4e8b417
2 changed files with 24 additions and 4 deletions

View File

@ -29,6 +29,7 @@ import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMove;
import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMoveLook;
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
import net.minecraft.server.v1_7_R4.PacketPlayOutUpdateAttributes;
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment;
import net.minecraft.server.v1_7_R4.PacketPlayOutNamedSoundEffect;
@ -597,10 +598,23 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
packetInfo.setCancelled(true);
}
}
else if (packet instanceof PacketPlayOutSpawnEntity || packet instanceof PacketPlayOutNamedEntitySpawn)
else if (packet instanceof PacketPlayOutSpawnEntity || packet instanceof PacketPlayOutSpawnEntityLiving
|| packet instanceof PacketPlayOutNamedEntitySpawn)
{
int entityId = packet instanceof PacketPlayOutSpawnEntity ? ((PacketPlayOutSpawnEntity) packet).a
: ((PacketPlayOutNamedEntitySpawn) packet).a;
int entityId = -1;
if (packet instanceof PacketPlayOutSpawnEntity)
{
entityId = ((PacketPlayOutSpawnEntity) packet).a;
}
else if (packet instanceof PacketPlayOutSpawnEntityLiving)
{
entityId = ((PacketPlayOutSpawnEntityLiving) packet).a;
}
else if (packet instanceof PacketPlayOutNamedEntitySpawn)
{
entityId = ((PacketPlayOutNamedEntitySpawn) packet).a;
}
if (_futureDisguises.containsKey(entityId))
{

View File

@ -1,5 +1,7 @@
package mineplex.core.disguise.disguises;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
@ -31,7 +33,11 @@ public class DisguisePlayer extends DisguiseHuman
public void setProfile(GameProfile profile)
{
_profile = profile;
GameProfile newProfile = new GameProfile(UUID.randomUUID(), profile.getName());
newProfile.getProperties().putAll(profile.getProperties());
_profile = newProfile;
}
public BlockFace getSleepingDirection()