Class AdventurePacketConvertor

java.lang.Object
net.minestom.server.adventure.AdventurePacketConvertor

public class AdventurePacketConvertor extends Object
Utility methods to convert adventure enums to their packet values.
  • Method Details

    • getBossBarOverlayValue

      public static int getBossBarOverlayValue(@NotNull BossBar.Overlay overlay)
      Gets the int value of a boss bar overlay.
      Parameters:
      overlay - the overlay
      Returns:
      the value
    • getBossBarFlagValue

      public static byte getBossBarFlagValue(@NotNull @NotNull Collection<BossBar.Flag> flags)
      Gets the byte value of a collection of boss bar flags.
      Parameters:
      flags - the flags
      Returns:
      the value
    • getBossBarColorValue

      public static int getBossBarColorValue(@NotNull BossBar.Color color)
      Gets the int value of a boss bar color.
      Parameters:
      color - the color
      Returns:
      the value
    • getSoundSourceValue

      public static int getSoundSourceValue(@NotNull Sound.Source source)
      Gets the int value of a sound source.
      Parameters:
      source - the source
      Returns:
      the value
    • getNamedTextColorValue

      public static int getNamedTextColorValue(@NotNull @NotNull NamedTextColor color)
      Gets the int value from a named text color.
      Parameters:
      color - the color
      Returns:
      the int value
    • createSoundPacket

      @NotNull public static @NotNull ServerPacket createSoundPacket(@NotNull @NotNull Sound sound, double x, double y, double z)
      Creates a sound packet from a sound and a location.
      Random variation by default unless a seed is provided in the Sound.
      Parameters:
      sound - the sound
      x - the x coordinate
      y - the y coordinate
      z - the z coordinate
      Returns:
      the sound packet
    • createSoundPacket

      @NotNull public static @NotNull ServerPacket createSoundPacket(@NotNull @NotNull Sound sound, @NotNull Sound.Emitter emitter)
      Creates a sound effect packet from a sound and an emitter.
      Random variation by default unless a seed is provided in the Sound.
      Parameters:
      sound - the sound
      emitter - the emitter, must be an Entity
      Returns:
      the sound packet
    • createSoundStopPacket

      public static ServerPacket createSoundStopPacket(@NotNull @NotNull SoundStop stop)
      Creates a sound stop packet from a sound stop.
      Parameters:
      stop - the sound stop
      Returns:
      the sound stop packet
    • createTitlePartPacket

      @NotNull public static <T> @NotNull ServerPacket createTitlePartPacket(@NotNull @NotNull TitlePart<T> part, @NotNull T value)
      Creates one of the three title packets from a title part and a value.
      Type Parameters:
      T - the type of the part
      Parameters:
      part - the part
      value - the value
      Returns:
      the title packet