Fix CraftPlayerProfile#setId regression (#9822)
This commit is contained in:
		
					parent
					
						
							
								2e77a0596d
							
						
					
				
			
			
				commit
				
					
						c5941e1633
					
				
			
		
					 1 changed files with 10 additions and 3 deletions
				
			
		|  | @ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 | ||||||
| +    }
 | +    }
 | ||||||
| +
 | +
 | ||||||
| +    public CraftPlayerProfile(UUID id, String name) {
 | +    public CraftPlayerProfile(UUID id, String name) {
 | ||||||
| +        this.profile = new GameProfile(id != null ? id : Util.NIL_UUID, name != null ? name : "");
 | +        this.profile = createAuthLibProfile(id, name);
 | ||||||
| +    }
 | +    }
 | ||||||
| +
 | +
 | ||||||
| +    public CraftPlayerProfile(GameProfile profile) {
 | +    public CraftPlayerProfile(GameProfile profile) {
 | ||||||
|  | @ -111,7 +111,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 | ||||||
| +    public UUID setId(@Nullable UUID uuid) {
 | +    public UUID setId(@Nullable UUID uuid) {
 | ||||||
| +        final GameProfile previousProfile = this.profile;
 | +        final GameProfile previousProfile = this.profile;
 | ||||||
| +        final UUID previousId = this.getId();
 | +        final UUID previousId = this.getId();
 | ||||||
| +        this.profile = new GameProfile(previousProfile.getId(), previousProfile.getName());
 | +        this.profile = createAuthLibProfile(uuid, previousProfile.getName());
 | ||||||
| +        copyProfileProperties(previousProfile, this.profile);
 | +        copyProfileProperties(previousProfile, this.profile);
 | ||||||
| +        return previousId;
 | +        return previousId;
 | ||||||
| +    }
 | +    }
 | ||||||
|  | @ -131,7 +131,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 | ||||||
| +    @Deprecated(forRemoval = true)
 | +    @Deprecated(forRemoval = true)
 | ||||||
| +    public String setName(@Nullable String name) {
 | +    public String setName(@Nullable String name) {
 | ||||||
| +        GameProfile prev = this.profile;
 | +        GameProfile prev = this.profile;
 | ||||||
| +        this.profile = new GameProfile(prev.getId(), name != null ? name : "");
 | +        this.profile = createAuthLibProfile(prev.getId(), name);
 | ||||||
| +        copyProfileProperties(prev, this.profile);
 | +        copyProfileProperties(prev, this.profile);
 | ||||||
| +        return prev.getName();
 | +        return prev.getName();
 | ||||||
| +    }
 | +    }
 | ||||||
|  | @ -281,6 +281,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 | ||||||
| +        }
 | +        }
 | ||||||
| +    }
 | +    }
 | ||||||
| +
 | +
 | ||||||
|  | +    private static GameProfile createAuthLibProfile(UUID uniqueId, String name) {
 | ||||||
|  | +        return new GameProfile(
 | ||||||
|  | +            uniqueId != null ? uniqueId : Util.NIL_UUID,
 | ||||||
|  | +            name != null ? name : ""
 | ||||||
|  | +        );
 | ||||||
|  | +    }
 | ||||||
|  | +
 | ||||||
| +    private static ProfileProperty toBukkit(Property property) {
 | +    private static ProfileProperty toBukkit(Property property) {
 | ||||||
| +        return new ProfileProperty(property.name(), property.value(), property.signature());
 | +        return new ProfileProperty(property.name(), property.value(), property.signature());
 | ||||||
| +    }
 | +    }
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 SplotyCode
				SplotyCode