Class SoundEventSelection
java.lang.Object
me.gamercoder215.starcosmetics.api.player.SoundEventSelection
- All Implemented Interfaces:
ConfigurationSerializable
Represents an entry in a player's configuration for a sound to be played on any events in
AVAILABLE_EVENTS.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionA List of all Available Events to be used in aSoundEventSelection. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull SoundEventSelection.Builderbuilder()Fetches the SoundEventSelection Builder.@NotNull SoundEventSelectionClones this SoundEventSelection with a new Event.@NotNull SoundEventSelectioncloneTo(@NotNull OfflinePlayer player) Clones this SoundEventSelection with a new owner.@NotNull SoundEventSelectionClones this SoundEventSelection with a new Sound.@NotNull SoundEventSelectionClones this SoundEventSelection with a new Sound, pitch, and volume.static @Nullable SoundEventSelectiondeserialize(@NotNull Map<String, Object> serial) Deserializes a Map into a SoundEventSelection.booleanbooleanequalsIgnorePlayer(@NotNull SoundEventSelection other) Whether this SoundEventSelection equals another SoundEventSelection, ignoring the player.getEvent()Fetches the Event that this SoundEventSelection is listening for.floatgetPitch()Fetches the pitch of the sound.@NotNull OfflinePlayerFetches the player that this SoundEventSelection belongs to.@NotNull SoundgetSound()Fetches the Sound that this SoundEventSelection will play.@NotNull DateFetches the Date this SoundEventSelection was created.floatFetches the volume of the sound.inthashCode()static booleanChecks whether this event is valid to listen to.static SoundEventSelectionof(@NotNull Class<? extends Event> event, @NotNull Sound sound, float volume, float pitch, @NotNull OfflinePlayer player, @NotNull Date date) Creates a new instance.voidPlays this sound with its volume and pitch.voidPlays this sound with its volume and pitch.toString()
-
Field Details
-
AVAILABLE_EVENTS
A List of all Available Events to be used in a
This list is not mutable; Integration for custom events is supported.SoundEventSelection.
-
-
Method Details
-
of
public static SoundEventSelection of(@NotNull @NotNull Class<? extends Event> event, @NotNull @NotNull Sound sound, float volume, float pitch, @NotNull @NotNull OfflinePlayer player, @NotNull @NotNull Date date) Creates a new instance.- Parameters:
event- The event to play the sound on.sound- The sound to play.volume- The volume of the sound.pitch- The pitch of the sound.player- The Player that owns this SoundEventSelection.date- The Timestamp that this sound was created at.- Returns:
- Constructed SoundEventSelection
-
isValid
Checks whether this event is valid to listen to.- Parameters:
event- The event to check.- Returns:
- true if valid, false otherwise
-
getPlayer
Fetches the player that this SoundEventSelection belongs to.- Returns:
- OfflinePlayer
-
getSound
Fetches the Sound that this SoundEventSelection will play.- Returns:
- Sound
-
getTimestamp
Fetches the Date this SoundEventSelection was created.- Returns:
- Timestamp of Creation
-
getVolume
public float getVolume()Fetches the volume of the sound.- Returns:
- Sound Volume
-
play
Plays this sound with its volume and pitch.- Parameters:
loc- The location to play the sound at.
-
play
Plays this sound with its volume and pitch.- Parameters:
en- The entity to play the sound at.
-
getPitch
public float getPitch()Fetches the pitch of the sound.- Returns:
- Sound Pitch
-
getEvent
Fetches the Event that this SoundEventSelection is listening for.- Returns:
- Class of the Event
-
cloneTo
Clones this SoundEventSelection with a new owner.- Parameters:
player- The new owner of this SoundEventSelection.- Returns:
- Cloned SoundEventSelection
-
cloneTo
@NotNull public @NotNull SoundEventSelection cloneTo(@NotNull @NotNull Sound s, float volume, float pitch) Clones this SoundEventSelection with a new Sound, pitch, and volume.- Parameters:
s- The new Sound to play.volume- The new volume of the sound.pitch- The new pitch of the sound.- Returns:
- Cloned SoundEventSelection
-
cloneTo
Clones this SoundEventSelection with a new Sound.- Parameters:
s- The new Sound to play.- Returns:
- Cloned SoundEventSelection
-
cloneTo
Clones this SoundEventSelection with a new Event.- Parameters:
e- The new Event to listen for.- Returns:
- Cloned SoundEventSelection
-
toString
-
equals
-
hashCode
public int hashCode() -
equalsIgnorePlayer
Whether this SoundEventSelection equals another SoundEventSelection, ignoring the player.- Parameters:
other- The other SoundEventSelection- Returns:
- Whether the two SoundEventSelections are equal without the player
-
deserialize
@Nullable public static @Nullable SoundEventSelection deserialize(@NotNull @NotNull Map<String, Object> serial) Deserializes a Map into a SoundEventSelection.- Parameters:
serial- Serialization fromserialize()- Returns:
- Deserialized SoundEventSelection
-
serialize
- Specified by:
serializein interfaceConfigurationSerializable
-
builder
Fetches the SoundEventSelection Builder.- Returns:
- SoundEventSelection Builder
-