Tweaked player disguise.

This commit is contained in:
Jonathan Williams 2014-08-22 18:21:23 -05:00
parent b67b2f04b7
commit ebb4c44bdc

View File

@ -2,6 +2,7 @@ package mineplex.core.disguise.disguises;
import java.util.UUID; import java.util.UUID;
import mineplex.core.common.util.UUIDFetcher;
import net.minecraft.server.v1_7_R4.MathHelper; import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R4.Packet; import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn; import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn;
@ -10,6 +11,7 @@ import net.minecraft.util.com.mojang.authlib.GameProfile;
public class DisguisePlayer extends DisguiseHuman public class DisguisePlayer extends DisguiseHuman
{ {
private String _name; private String _name;
private UUID _uuid;
public DisguisePlayer(org.bukkit.entity.Entity entity) public DisguisePlayer(org.bukkit.entity.Entity entity)
{ {
@ -29,6 +31,8 @@ public class DisguisePlayer extends DisguiseHuman
_name = name.substring(0, 16); _name = name.substring(0, 16);
else else
_name = name; _name = name;
_uuid = UUIDFetcher.getUUIDOf(_name);
} }
@Override @Override
@ -36,7 +40,7 @@ public class DisguisePlayer extends DisguiseHuman
{ {
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn(); PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
packet.a = Entity.getId(); packet.a = Entity.getId();
packet.b = new GameProfile(UUID.randomUUID(), _name); packet.b = new GameProfile(_uuid, _name);
packet.c = MathHelper.floor(Entity.locX * 32.0D); packet.c = MathHelper.floor(Entity.locX * 32.0D);
packet.d = MathHelper.floor(Entity.locY * 32.0D); packet.d = MathHelper.floor(Entity.locY * 32.0D);
packet.e = MathHelper.floor(Entity.locZ * 32.0D); packet.e = MathHelper.floor(Entity.locZ * 32.0D);