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;
|
return selfDisguisesIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UUID getUUID(final Disguise disguise, final String playerName) {
|
public static UUID getUUID() {
|
||||||
if (LibVersion.getGameVersion() == LibVersion.V1_7) {
|
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();
|
EthernetAddress addr = EthernetAddress.fromInterface();
|
||||||
TimeBasedGenerator uuidGenerator = Generators.timeBasedGenerator(addr);
|
TimeBasedGenerator uuidGenerator = Generators.timeBasedGenerator(addr);
|
||||||
return uuidGenerator.generate();
|
return uuidGenerator.generate();
|
||||||
|
@ -200,11 +200,8 @@ public class PacketsManager {
|
|||||||
stringMods.write(i, ((PlayerDisguise) disguise).getName());
|
stringMods.write(i, ((PlayerDisguise) disguise).getName());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
spawnPackets[0].getModifier().write(
|
spawnPackets[0].getModifier().write(1,
|
||||||
1,
|
ReflectionManager.getGameProfile(DisguiseUtilities.getUUID(), ((PlayerDisguise) disguise).getName()));
|
||||||
ReflectionManager.getGameProfile(
|
|
||||||
DisguiseUtilities.getUUID(disguise, ((PlayerDisguise) disguise).getName()),
|
|
||||||
((PlayerDisguise) disguise).getName()));
|
|
||||||
}
|
}
|
||||||
StructureModifier<Integer> intMods = spawnPackets[0].getIntegers();
|
StructureModifier<Integer> intMods = spawnPackets[0].getIntegers();
|
||||||
intMods.write(0, disguisedEntity.getEntityId());
|
intMods.write(0, disguisedEntity.getEntityId());
|
||||||
|
@ -208,8 +208,14 @@ public class ReflectionManager {
|
|||||||
|
|
||||||
public static Object getGameProfile(UUID uuid, String playerName) {
|
public static Object getGameProfile(UUID uuid, String playerName) {
|
||||||
try {
|
try {
|
||||||
return Class.forName("net.minecraft.util.com.mojang.authlib.GameProfile").getConstructor(String.class, String.class)
|
try {
|
||||||
.newInstance(uuid != null ? uuid.toString() : "", playerName);
|
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) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user