Skip to content

Commit

Permalink
Citizens no longer uses v2 uuids so strip away our code for that
Browse files Browse the repository at this point in the history
including our own custom player entities i guess
  • Loading branch information
mcmonkey4eva committed Feb 13, 2023
1 parent 3be9462 commit 062ef86
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 31 deletions.
Expand Up @@ -21,17 +21,6 @@ public MirrorTrait() {
super("mirror");
}

public static UUID getUUID(NPC npc) {
UUID uuid = npc.getUniqueId();
if (uuid.version() == 4) { // clear version
long msb = uuid.getMostSignificantBits();
msb &= ~0x0000000000004000L;
msb |= 0x0000000000002000L;
uuid = new UUID(msb, uuid.getLeastSignificantBits());
}
return uuid;
}

public void respawn() {
Bukkit.getScheduler().scheduleSyncDelayedTask(Denizen.getInstance(), () -> {
if (npc.isSpawned()) {
Expand All @@ -46,15 +35,15 @@ public void respawn() {

public void mirrorOn() {
NetworkInterceptHelper.enable();
UUID uuid = getUUID(npc);
UUID uuid = npc.getUniqueId();
if (!ProfileEditor.mirrorUUIDs.contains(uuid)) {
ProfileEditor.mirrorUUIDs.add(uuid);
respawn();
}
}

public void mirrorOff() {
UUID uuid = getUUID(npc);
UUID uuid = npc.getUniqueId();
if (ProfileEditor.mirrorUUIDs.contains(uuid)) {
ProfileEditor.mirrorUUIDs.remove(uuid);
respawn();
Expand Down
Expand Up @@ -107,12 +107,6 @@ else if (name.length() > 46) {
playerProfile.setTextureSignature(skinProfile.getTextureSignature());
}
UUID uuid = UUID.randomUUID();
if (uuid.version() == 4) {
long msb = uuid.getMostSignificantBits();
msb &= ~0x0000000000004000L;
msb |= 0x0000000000002000L;
uuid = new UUID(msb, uuid.getLeastSignificantBits());
}
playerProfile.setUniqueId(uuid);

GameProfile gameProfile = new GameProfile(playerProfile.getUniqueId(), playerProfile.getName());
Expand Down
Expand Up @@ -110,12 +110,6 @@ else if (skin == null && !name.matches(".*[^A-Za-z0-9_].*")) {
playerProfile.setTextureSignature(skinProfile.getTextureSignature());
}
UUID uuid = UUID.randomUUID();
if (uuid.version() == 4) {
long msb = uuid.getMostSignificantBits();
msb &= ~0x0000000000004000L;
msb |= 0x0000000000002000L;
uuid = new UUID(msb, uuid.getLeastSignificantBits());
}
playerProfile.setUniqueId(uuid);

GameProfile gameProfile = new GameProfile(playerProfile.getUniqueId(), playerProfile.getName());
Expand Down
Expand Up @@ -110,12 +110,6 @@ else if (skin == null && !name.matches(".*[^A-Za-z0-9_].*")) {
playerProfile.setTextureSignature(skinProfile.getTextureSignature());
}
UUID uuid = UUID.randomUUID();
if (uuid.version() == 4) {
long msb = uuid.getMostSignificantBits();
msb &= ~0x0000000000004000L;
msb |= 0x0000000000002000L;
uuid = new UUID(msb, uuid.getLeastSignificantBits());
}
playerProfile.setUniqueId(uuid);

GameProfile gameProfile = new GameProfile(playerProfile.getUniqueId(), playerProfile.getName());
Expand Down

0 comments on commit 062ef86

Please sign in to comment.