com.destroystokyo.paper.profile.ProfileProperty Java Examples

The following examples show how to use com.destroystokyo.paper.profile.ProfileProperty. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PreLookupProfileEvent.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Get the properties for this profile
 *
 * @return the property map to attach to the new {@link PlayerProfile}
 * @deprecated will be removed with 1.13  Use {@link #getProfileProperties()}
 */
@Deprecated
@Nonnull
public Multimap<String, Property> getProperties() {
    Multimap<String, Property> props = ArrayListMultimap.create();

    for (ProfileProperty property : properties) {
        props.put(property.getName(), new Property(property.getName(), property.getValue(), property.getSignature()));
    }
    return props;
}
 
Example #2
Source File: PreLookupProfileEvent.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Completely replaces all Properties with the new provided properties
 *
 * @param properties the properties to set on the new profile
 * @deprecated will be removed with 1.13 Use {@link #setProfileProperties(Set)}
 */
@Deprecated
public void setProperties(Multimap<String, Property> properties) {
    this.properties = new HashSet<>();
    properties.values().forEach(property -> {
        this.properties.add(new ProfileProperty(property.getName(), property.getValue(), property.getSignature()));
    });
}
 
Example #3
Source File: PreLookupProfileEvent.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Adds additional properties, without removing the original properties
 *
 * @param properties the properties to add to the existing properties
 * @deprecated will be removed with 1.13 use {@link #addProfileProperties(Set)}
 */
@Deprecated
public void addProperties(Multimap<String, Property> properties) {
    properties.values().forEach(property -> {
        this.properties.add(new ProfileProperty(property.getName(), property.getValue(), property.getSignature()));
    });
}
 
Example #4
Source File: NBTUtil.java    From VoxelGamesLibv2 with MIT License 5 votes vote down vote up
/**
 * Sets a player profile onto the given tag
 *
 * @param nbt           the tag to set the profile to
 * @param playerProfile the profile to set
 */
public static void setPlayerProfile(NbtCompound nbt, PlayerProfile playerProfile) {
    nbt.put("Id", (playerProfile.getId() == null ? UUID.nameUUIDFromBytes(("OfflinePlayer:" + playerProfile.getName()).getBytes()) : playerProfile.getId()).toString());
    nbt.put("Name", playerProfile.getName());
    if (!nbt.containsKey("Properties")) return;
    NbtCompound properties = nbt.getCompound("Properties");
    NbtList list = properties.getList("textures");
    Map<String, NbtBase> texture = (Map<String, NbtBase>) list.getValue(0);
    for (ProfileProperty property : playerProfile.getProperties()) {
        texture.put("name", NbtFactory.of("name", property.getValue()));
        texture.put("Signature", NbtFactory.of("Signature", property.getSignature()));
        texture.put("Value", NbtFactory.of("Value", property.getValue()));
    }
}
 
Example #5
Source File: TextureHandler.java    From VoxelGamesLibv2 with MIT License 4 votes vote down vote up
public PlayerProfile getPlayerProfile(Skin skin) {
    PlayerProfile playerProfile = Bukkit.createProfile(skin.data.uuid, skin.name);
    playerProfile.setProperty(new ProfileProperty("textures", skin.data.texture.value, skin.data.texture.signature));
    return playerProfile;
}
 
Example #6
Source File: PlayerProfileTypeAdapter.java    From VoxelGamesLibv2 with MIT License 4 votes vote down vote up
public Dummy(@Nullable UUID id, @Nullable String name, Set<ProfileProperty> properties) {
    this.id = id;
    this.name = name;
    this.properties = properties;
}
 
Example #7
Source File: PaperPingResponseHandler.java    From ProtocolSupport with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public Set<ProfileProperty> getProperties() {
	return Collections.emptySet();
}
 
Example #8
Source File: PaperPingResponseHandler.java    From ProtocolSupport with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void setProperties(Collection<ProfileProperty> arg0) {
}
 
Example #9
Source File: PaperPingResponseHandler.java    From ProtocolSupport with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void setProperty(ProfileProperty arg0) {
}
 
Example #10
Source File: PreLookupProfileEvent.java    From Kettle with GNU General Public License v3.0 2 votes vote down vote up
/**
 * @return The currently pending prepopulated properties.
 * Any property in this Set will be automatically prefilled on this Profile
 */
public Set<ProfileProperty> getProfileProperties() {
    return this.properties;
}
 
Example #11
Source File: PreLookupProfileEvent.java    From Kettle with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Clears any existing prepopulated properties and uses the supplied properties
 * Any property in this Set will be automatically prefilled on this Profile
 *
 * @param properties The properties to add
 */
public void setProfileProperties(Set<ProfileProperty> properties) {
    this.properties = new HashSet<>();
    this.properties.addAll(properties);
}
 
Example #12
Source File: PreLookupProfileEvent.java    From Kettle with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Adds any properties currently missing to the prepopulated properties set, replacing any that already were set.
 * Any property in this Set will be automatically prefilled on this Profile
 *
 * @param properties The properties to add
 */
public void addProfileProperties(Set<ProfileProperty> properties) {
    this.properties.addAll(properties);
}
 
Example #13
Source File: FillProfileEvent.java    From Kettle with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Same as .getPlayerProfile().getProperties()
 *
 * @return The new properties on the profile.
 * @see PlayerProfile#getProperties()
 */
public Set<ProfileProperty> getProperties() {
    return profile.getProperties();
}
 
Example #14
Source File: PreFillProfileEvent.java    From Kettle with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Sets the properties on the profile, avoiding the call to the Mojang API
 * Same as .getPlayerProfile().setProperties(properties);
 *
 * @param properties The properties to set/append
 * @see PlayerProfile#setProperties(Collection)
 */
public void setProperties(@Nonnull Collection<ProfileProperty> properties) {
    profile.setProperties(properties);
}