mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-09-12 01:48:07 +02:00
Allow disguises in 1.7.6 - 1.7.8 but no skins for players!!
This commit is contained in:
parent
c3c6a5c1c4
commit
8c2261798e
@ -299,20 +299,8 @@ public class DisguiseUtilities {
|
||||
return selfDisguisesIds;
|
||||
}
|
||||
|
||||
public static UUID getUUID(final Disguise disguise, final String playerName) {
|
||||
public static UUID getUUID() {
|
||||
if (LibVersion.getGameVersion() == LibVersion.V1_7) {
|
||||
Player p = Bukkit.getPlayerExact(playerName);
|
||||
if (p != null) {
|
||||
try {
|
||||
Field field = ReflectionManager.getNmsClass("PlayerConnection").getDeclaredField("processedDisconnect");
|
||||
field.setAccessible(true);
|
||||
if (!field.getBoolean(ReflectionManager.getNmsClass("EntityPlayer").getField("playerConnection")
|
||||
.get(p.getClass().getDeclaredMethod("getHandle").invoke(p))))
|
||||
return p.getUniqueId();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
EthernetAddress addr = EthernetAddress.fromInterface();
|
||||
TimeBasedGenerator uuidGenerator = Generators.timeBasedGenerator(addr);
|
||||
return uuidGenerator.generate();
|
||||
|
@ -200,11 +200,8 @@ public class PacketsManager {
|
||||
stringMods.write(i, ((PlayerDisguise) disguise).getName());
|
||||
}
|
||||
} else {
|
||||
spawnPackets[0].getModifier().write(
|
||||
1,
|
||||
ReflectionManager.getGameProfile(
|
||||
DisguiseUtilities.getUUID(disguise, ((PlayerDisguise) disguise).getName()),
|
||||
((PlayerDisguise) disguise).getName()));
|
||||
spawnPackets[0].getModifier().write(1,
|
||||
ReflectionManager.getGameProfile(DisguiseUtilities.getUUID(), ((PlayerDisguise) disguise).getName()));
|
||||
}
|
||||
StructureModifier<Integer> intMods = spawnPackets[0].getIntegers();
|
||||
intMods.write(0, disguisedEntity.getEntityId());
|
||||
|
@ -208,8 +208,14 @@ public class ReflectionManager {
|
||||
|
||||
public static Object getGameProfile(UUID uuid, String playerName) {
|
||||
try {
|
||||
return Class.forName("net.minecraft.util.com.mojang.authlib.GameProfile").getConstructor(String.class, String.class)
|
||||
.newInstance(uuid != null ? uuid.toString() : "", playerName);
|
||||
try {
|
||||
return Class.forName("net.minecraft.util.com.mojang.authlib.GameProfile")
|
||||
.getConstructor(UUID.class, String.class)
|
||||
.newInstance(uuid != null ? uuid : DisguiseUtilities.getUUID(), playerName);
|
||||
} catch (NoSuchMethodException ex) {
|
||||
return Class.forName("net.minecraft.util.com.mojang.authlib.GameProfile")
|
||||
.getConstructor(String.class, String.class).newInstance(uuid != null ? uuid.toString() : "", playerName);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user