geforkt von Mirrors/Paper
Ignore checks in CraftPlayerProfile for ResolvableProfile used in profile components
By: Doc <nachito94@msn.com>
Dieser Commit ist enthalten in:
Ursprung
3919314de0
Commit
106225f127
@ -47,7 +47,7 @@ public final class CraftPlayerProfile implements PlayerProfile {
|
|||||||
public static ResolvableProfile validateSkullProfile(@Nonnull ResolvableProfile resolvableProfile) {
|
public static ResolvableProfile validateSkullProfile(@Nonnull ResolvableProfile resolvableProfile) {
|
||||||
// The ResolvableProfile needs to contain either both a uuid and textures, or a name.
|
// The ResolvableProfile needs to contain either both a uuid and textures, or a name.
|
||||||
boolean isValidSkullProfile = (resolvableProfile.name().isPresent())
|
boolean isValidSkullProfile = (resolvableProfile.name().isPresent())
|
||||||
|| (resolvableProfile.id().isPresent() && resolvableProfile.properties().containsKey(CraftPlayerTextures.PROPERTY_NAME));
|
|| (resolvableProfile.id().isPresent() || resolvableProfile.properties().containsKey(CraftPlayerTextures.PROPERTY_NAME));
|
||||||
Preconditions.checkArgument(isValidSkullProfile, "The skull profile is missing a name or textures!");
|
Preconditions.checkArgument(isValidSkullProfile, "The skull profile is missing a name or textures!");
|
||||||
return resolvableProfile;
|
return resolvableProfile;
|
||||||
}
|
}
|
||||||
@ -63,15 +63,22 @@ public final class CraftPlayerProfile implements PlayerProfile {
|
|||||||
private final PropertyMap properties = new PropertyMap();
|
private final PropertyMap properties = new PropertyMap();
|
||||||
private final CraftPlayerTextures textures = new CraftPlayerTextures(this);
|
private final CraftPlayerTextures textures = new CraftPlayerTextures(this);
|
||||||
|
|
||||||
public CraftPlayerProfile(UUID uniqueId, String name) {
|
private CraftPlayerProfile(UUID uniqueId, String name, boolean applyPreconditions) {
|
||||||
|
if (applyPreconditions) {
|
||||||
Preconditions.checkArgument((uniqueId != null) || !StringUtils.isBlank(name), "uniqueId is null or name is blank");
|
Preconditions.checkArgument((uniqueId != null) || !StringUtils.isBlank(name), "uniqueId is null or name is blank");
|
||||||
|
}
|
||||||
this.uniqueId = uniqueId;
|
this.uniqueId = uniqueId;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CraftPlayerProfile(UUID uniqueId, String name) {
|
||||||
|
this(uniqueId, name, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The ResolvableProfile used in Components can have just the properties then need ignore all checks internally
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public CraftPlayerProfile(@Nonnull ResolvableProfile resolvableProfile) {
|
public CraftPlayerProfile(@Nonnull ResolvableProfile resolvableProfile) {
|
||||||
this(resolvableProfile.id().orElse(null), resolvableProfile.name().orElse(null));
|
this(resolvableProfile.id().orElse(null), resolvableProfile.name().orElse(null), false);
|
||||||
this.properties.putAll(resolvableProfile.properties());
|
this.properties.putAll(resolvableProfile.properties());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren