mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 12:13:54 -07:00
Implement API for dealing with player UUIDs. Adds BUKKIT-5071
This commit is contained in:
@@ -4,6 +4,7 @@ import java.io.File;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.server.BanEntry;
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
@@ -41,6 +42,20 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
return name;
|
||||
}
|
||||
|
||||
// TODO: In 1.7.6+ OfflinePlayer lookup should be by UUID and store it like it does the name now
|
||||
public UUID getUniqueId() {
|
||||
NBTTagCompound data = getData();
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (data.hasKeyOfType("UUIDMost", 4) && data.hasKeyOfType("UUIDLeast", 4)) {
|
||||
return new UUID(data.getLong("UUIDMost"), data.getLong("UUIDLeast"));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Server getServer() {
|
||||
return server;
|
||||
}
|
||||
|
Reference in New Issue
Block a user