Package org.bukkit

Class Note

java.lang.Object
org.bukkit.Note

public class Note extends Object
A note class to store a specific note.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    An enum holding tones.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Note(int note)
    Creates a new note.
    Note(int octave, @NotNull Note.Tone tone, boolean sharped)
    Creates a new note.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    static @NotNull Note
    flat(int octave, @NotNull Note.Tone tone)
    Creates a new note for a flat tone, such as A-flat.
    @NotNull Note
     
    byte
    Returns the internal id of this note.
    int
    Returns the octave of this note.
    float
    Gets the pitch of this note.
    @NotNull Note.Tone
    Returns the tone of this note.
    int
     
    boolean
    Returns if this note is sharped.
    static @NotNull Note
    natural(int octave, @NotNull Note.Tone tone)
    Creates a new note for a natural tone, such as A-natural.
    static @NotNull Note
    sharp(int octave, @NotNull Note.Tone tone)
    Creates a new note for a sharp tone, such as A-sharp.
    @NotNull Note
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Note

      public Note(int note)
      Creates a new note.
      Parameters:
      note - Internal note id. getId() always return this value. The value has to be in the interval [0; 24].
    • Note

      public Note(int octave, @NotNull @NotNull Note.Tone tone, boolean sharped)
      Creates a new note.
      Parameters:
      octave - The octave where the note is in. Has to be 0 - 2.
      tone - The tone within the octave. If the octave is 2 the note has to be F#.
      sharped - Set if the tone is sharped (e.g. for F#).
  • Method Details

    • flat

      @NotNull public static @NotNull Note flat(int octave, @NotNull @NotNull Note.Tone tone)
      Creates a new note for a flat tone, such as A-flat.
      Parameters:
      octave - The octave where the note is in. Has to be 0 - 1.
      tone - The tone within the octave.
      Returns:
      The new note.
    • sharp

      @NotNull public static @NotNull Note sharp(int octave, @NotNull @NotNull Note.Tone tone)
      Creates a new note for a sharp tone, such as A-sharp.
      Parameters:
      octave - The octave where the note is in. Has to be 0 - 2.
      tone - The tone within the octave. If the octave is 2 the note has to be F#.
      Returns:
      The new note.
    • natural

      @NotNull public static @NotNull Note natural(int octave, @NotNull @NotNull Note.Tone tone)
      Creates a new note for a natural tone, such as A-natural.
      Parameters:
      octave - The octave where the note is in. Has to be 0 - 1.
      tone - The tone within the octave.
      Returns:
      The new note.
    • sharped

      @NotNull public @NotNull Note sharped()
      Returns:
      The note a semitone above this one.
    • flattened

      @NotNull public @NotNull Note flattened()
      Returns:
      The note a semitone below this one.
    • getId

      @Internal public byte getId()
      Returns the internal id of this note.
      Returns:
      the internal id of this note.
      API Note:
      Internal Use Only
    • getOctave

      public int getOctave()
      Returns the octave of this note.
      Returns:
      the octave of this note.
    • getTone

      @NotNull public @NotNull Note.Tone getTone()
      Returns the tone of this note.
      Returns:
      the tone of this note.
    • isSharped

      public boolean isSharped()
      Returns if this note is sharped.
      Returns:
      if this note is sharped.
    • getPitch

      public float getPitch()
      Gets the pitch of this note. This is the value used with World.playSound(org.bukkit.Location, org.bukkit.Sound, float, float) or the /playsound command.
      Returns:
      the pitch
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object