13
0
geforkt von Mirrors/Velocity

Change 'set' prefixes to 'with' and add javadoc

Dieser Commit ist enthalten in:
Yeregorix 2018-11-12 21:34:57 +01:00
Ursprung b6bb4ad1a1
Commit da259951c7
3 geänderte Dateien mit 49 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -48,31 +48,69 @@ public final class GameProfile implements Identifiable {
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),
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(
UuidUtils.fromUndashed(Preconditions.checkNotNull(undashedId, "undashedId")), undashedId,
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"),
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));
}
/**
* 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) {
return new GameProfile(this.id, this.undashedId, this.name,
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) {
return new GameProfile(this.id, this.undashedId, this.name,
ImmutableList.<Property>builder().addAll(this.properties).add(property).build());

Datei anzeigen

@ -7,5 +7,10 @@ import java.util.UUID;
*/
public interface Identifiable {
UUID getUniqueId();
/**
* Returns the {@code UUID} attached to this object.
*
* @return the UUID
*/
UUID getUniqueId();
}

Datei anzeigen

@ -212,7 +212,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
@Override
public void setGameProfileProperties(List<GameProfile.Property> properties) {
this.profile = profile.setProperties(Preconditions.checkNotNull(properties));
this.profile = profile.withProperties(Preconditions.checkNotNull(properties));
}
@Override