Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-24 15:20:35 +01:00
Change 'set' prefixes to 'with' and add javadoc
Dieser Commit ist enthalten in:
Ursprung
b6bb4ad1a1
Commit
da259951c7
@ -48,31 +48,69 @@ public final class GameProfile implements Identifiable {
|
|||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameProfile setUniqueId(UUID id) {
|
/**
|
||||||
|
* Creates a new {@code GameProfile} with the specified unique id.
|
||||||
|
*
|
||||||
|
* @param id the new unique id
|
||||||
|
* @return the new {@code GameProfile}
|
||||||
|
*/
|
||||||
|
public GameProfile withUniqueId(UUID id) {
|
||||||
return new GameProfile(Preconditions.checkNotNull(id, "id"), UuidUtils.toUndashed(id),
|
return new GameProfile(Preconditions.checkNotNull(id, "id"), UuidUtils.toUndashed(id),
|
||||||
this.name, this.properties);
|
this.name, this.properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameProfile setUndashedId(String undashedId) {
|
/**
|
||||||
|
* Creates a new {@code GameProfile} with the specified undashed id.
|
||||||
|
*
|
||||||
|
* @param undashedId the new undashed id
|
||||||
|
* @return the new {@code GameProfile}
|
||||||
|
*/
|
||||||
|
public GameProfile withUndashedId(String undashedId) {
|
||||||
return new GameProfile(
|
return new GameProfile(
|
||||||
UuidUtils.fromUndashed(Preconditions.checkNotNull(undashedId, "undashedId")), undashedId,
|
UuidUtils.fromUndashed(Preconditions.checkNotNull(undashedId, "undashedId")), undashedId,
|
||||||
this.name, this.properties);
|
this.name, this.properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameProfile setName(String name) {
|
/**
|
||||||
|
* Creates a new {@code GameProfile} with the specified name.
|
||||||
|
*
|
||||||
|
* @param name the new name
|
||||||
|
* @return the new {@code GameProfile}
|
||||||
|
*/
|
||||||
|
public GameProfile withName(String name) {
|
||||||
return new GameProfile(this.id, this.undashedId, Preconditions.checkNotNull(name, "name"),
|
return new GameProfile(this.id, this.undashedId, Preconditions.checkNotNull(name, "name"),
|
||||||
this.properties);
|
this.properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameProfile setProperties(List<Property> properties) {
|
/**
|
||||||
|
* Creates a new {@code GameProfile} with the specified properties.
|
||||||
|
*
|
||||||
|
* @param properties the new properties
|
||||||
|
* @return the new {@code GameProfile}
|
||||||
|
*/
|
||||||
|
public GameProfile withProperties(List<Property> properties) {
|
||||||
return new GameProfile(this.id, this.undashedId, this.name, ImmutableList.copyOf(properties));
|
return new GameProfile(this.id, this.undashedId, this.name, ImmutableList.copyOf(properties));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@code GameProfile} with the properties of this object plus the specified
|
||||||
|
* properties.
|
||||||
|
*
|
||||||
|
* @param properties the properties to add
|
||||||
|
* @return the new {@code GameProfile}
|
||||||
|
*/
|
||||||
public GameProfile addProperties(Iterable<Property> properties) {
|
public GameProfile addProperties(Iterable<Property> properties) {
|
||||||
return new GameProfile(this.id, this.undashedId, this.name,
|
return new GameProfile(this.id, this.undashedId, this.name,
|
||||||
ImmutableList.<Property>builder().addAll(this.properties).addAll(properties).build());
|
ImmutableList.<Property>builder().addAll(this.properties).addAll(properties).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@code GameProfile} with the properties of this object plus the specified
|
||||||
|
* property.
|
||||||
|
*
|
||||||
|
* @param property the property to add
|
||||||
|
* @return the new {@code GameProfile}
|
||||||
|
*/
|
||||||
public GameProfile addProperty(Property property) {
|
public GameProfile addProperty(Property property) {
|
||||||
return new GameProfile(this.id, this.undashedId, this.name,
|
return new GameProfile(this.id, this.undashedId, this.name,
|
||||||
ImmutableList.<Property>builder().addAll(this.properties).add(property).build());
|
ImmutableList.<Property>builder().addAll(this.properties).add(property).build());
|
||||||
|
@ -7,5 +7,10 @@ import java.util.UUID;
|
|||||||
*/
|
*/
|
||||||
public interface Identifiable {
|
public interface Identifiable {
|
||||||
|
|
||||||
UUID getUniqueId();
|
/**
|
||||||
|
* Returns the {@code UUID} attached to this object.
|
||||||
|
*
|
||||||
|
* @return the UUID
|
||||||
|
*/
|
||||||
|
UUID getUniqueId();
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setGameProfileProperties(List<GameProfile.Property> properties) {
|
public void setGameProfileProperties(List<GameProfile.Property> properties) {
|
||||||
this.profile = profile.setProperties(Preconditions.checkNotNull(properties));
|
this.profile = profile.withProperties(Preconditions.checkNotNull(properties));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren