Class NoteBlockMusic

java.lang.Object
com.cryptomorin.xseries.NoteBlockMusic

public class NoteBlockMusic
extends Object
NoteBlockMusic - Write music scripts for Minecraft.
You can write small text scripts for Minecraft note blocks without needing to use any redstone or building to make your music. This class is independent of XSound.
Version:
1.0.0
Author:
Crypto Morin
See Also:
Instrument, Note.Tone
  • Constructor Details

  • Method Details

    • testMusic

      public static CompletableFuture<Void> testMusic​(@Nonnull org.bukkit.entity.Player player)
      A pre-written music script to test with playMusic(Player, Location, String) If you made a cool script using this let me know, I'll put it here. You can still give me the script and I'll put it on the Spigot page.
      Since:
      1.0.0
    • fromFile

      public static CompletableFuture<Void> fromFile​(@Nonnull org.bukkit.entity.Player player, @Nonnull org.bukkit.Location location, @Nonnull Path path)
      Plays a music from a file. This file can have YAML comments (#) and empty lines.
      Since:
      1.0.0
      See Also:
      playMusic(Player, Location, String)
    • playMusic

      public static CompletableFuture<Void> playMusic​(@Nonnull org.bukkit.entity.Player player, @Nonnull org.bukkit.Location location, @Nullable String script)
      This is a very special and unique method. This method allows you to write your own Minecraft music without needing to use redstones and note blocks.

      We'll take a whole thread for the music for blocking requests. Format:

      Instrument, Tone, Repeat (optional), Repeating Delay (optional, required if Repeat is used) [Next Delay]
      Both delays are in milliseconds.
      Also you can use segments (segment) to repeat a segment multiple times.

      Example

      Shortcuts: BD,G 20 BD,G 20 BD,G -> BD,G,3,20

       (BD,G,3,20 BG,E,5,10),1000,2 1000 BA,A
      
       Translated:
       Play BASS_DRUM with tone G 3 times every 20 ticks.
      Play BASS_GUITAR with tone E 5 times every 10 ticks.
      Play those ^ again two times with 1 second delay between repeats.
      Wait 1000ms.
      Play BANJO with tone A once.

      Note Tones

      Available Note Tones: G, A, B, C, D, E, F (Idk why G is the first one) Note.Tone
      You can also use sharp or flat tones by using '#' for sharp and '_' for flat e.g. B_ C#
      Octave numbers 1 and 2 can be used. C1, C#1, B_1, D_2

      Instruments

      Available Instruments: Basically the first letter of every instrument. E.g. BD -> BASS_DRUM
      You can also use their full name. Instrument

      CompletableFuture

      Warning: Do not use blocking methods such as join() or get() You may use cancel() or the then... methods.

      Parameters:
      player - in order to play the note we need a player instance. Any player.
      location - the location to play this note to.
      script - the music script.
      Returns:
      the async task processing the script.
      Since:
      1.0.0
      See Also:
      fromFile(Player, Location, Path)