Support setting uuid's on ServerPing.PlayerInfo + fix plugins which don't provide a valid uuid.
This commit is contained in:
@@ -3,6 +3,9 @@ package net.md_5.bungee.api;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import net.md_5.bungee.Util;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Represents the standard list data returned by opening a server in the
|
||||
@@ -42,7 +45,32 @@ public class ServerPing
|
||||
{
|
||||
|
||||
private String name;
|
||||
private String id;
|
||||
private UUID uniqueId;
|
||||
|
||||
private static final UUID md5UUID = Util.getUUID( "af74a02d19cb445bb07f6866a861f783" );
|
||||
|
||||
public PlayerInfo(String name, String id)
|
||||
{
|
||||
setName( name );
|
||||
setId( id );
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
try
|
||||
{
|
||||
uniqueId = Util.getUUID( id );
|
||||
} catch ( Exception e )
|
||||
{
|
||||
// Fallback on a valid uuid otherwise Minecraft complains
|
||||
uniqueId = md5UUID;
|
||||
}
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return uniqueId.toString().replaceAll( "-", "" );
|
||||
}
|
||||
}
|
||||
private String description;
|
||||
private String favicon;
|
||||
|
Reference in New Issue
Block a user