Fix for a Chinese player with UUID

This commit is contained in:
libraryaddict 2021-10-03 21:30:35 +13:00
parent 0f84008abd
commit 9a91b91966

View File

@ -871,20 +871,7 @@ public class ReflectionManager {
return uuid; return uuid;
} }
ByteBuffer bb = ByteBuffer.wrap(new byte[16]); return new UUID((uuid.getMostSignificantBits() & ~(4 << 12)) | ((long) DisguiseConfig.getUUIDGeneratedVersion() << 12), uuid.getLeastSignificantBits());
bb.putLong(uuid.getMostSignificantBits());
bb.putLong(uuid.getLeastSignificantBits());
bb.put(6, (byte) (bb.get(6) & 0x0f)); // clear version
bb.put(6, (byte) (bb.get(6) | DisguiseConfig.getUUIDGeneratedVersion())); // set to version X (Default 4)
bb.rewind();
long firstLong = bb.getLong();
long secondLong = bb.getLong();
return new UUID(firstLong, secondLong);
} }
private static String getLocation(String pack, String className) { private static String getLocation(String pack, String className) {
@ -1115,9 +1102,8 @@ public class ReflectionManager {
try { try {
Location loc = entity.getLocation(); Location loc = entity.getLocation();
Object boundingBox = boundingBoxConstructor Object boundingBox = boundingBoxConstructor.newInstance(loc.getX() - (newBox.getX() / 2), loc.getY(), loc.getZ() - (newBox.getZ() / 2),
.newInstance(loc.getX() - (newBox.getX() / 2), loc.getY(), loc.getZ() - (newBox.getZ() / 2), loc.getX() + (newBox.getX() / 2), loc.getX() + (newBox.getX() / 2), loc.getY() + newBox.getY(), loc.getZ() + (newBox.getZ() / 2));
loc.getY() + newBox.getY(), loc.getZ() + (newBox.getZ() / 2));
setBoundingBoxMethod.invoke(getNmsEntity(entity), boundingBox); setBoundingBoxMethod.invoke(getNmsEntity(entity), boundingBox);
} catch (Exception ex) { } catch (Exception ex) {
@ -1825,8 +1811,8 @@ public class ReflectionManager {
watcherClass = PufferFishWatcher.class; watcherClass = PufferFishWatcher.class;
break; break;
default: default:
watcherClass = (Class<? extends FlagWatcher>) Class watcherClass = (Class<? extends FlagWatcher>) Class.forName(
.forName("me.libraryaddict.disguise.disguisetypes.watchers." + toReadable(disguiseType.name()) + "Watcher"); "me.libraryaddict.disguise.disguisetypes.watchers." + toReadable(disguiseType.name()) + "Watcher");
break; break;
} }
} catch (ClassNotFoundException ex) { } catch (ClassNotFoundException ex) {