Class BungeeMessageOut

java.lang.Object
me.cooleg.bungeemessaging.OutgoingMessages.BungeeMessageOut
All Implemented Interfaces:
com.google.common.io.ByteArrayDataOutput, DataOutput
Direct Known Subclasses:
ForwardMessageOut

public class BungeeMessageOut extends Object implements com.google.common.io.ByteArrayDataOutput
Simplified way to write data out to a BungeeCord message. Should work for basically any message except for the ForwardMessages. For any messages that you need to add additional data, like a username for example, ByteArrayDataOutput methods are here for that.
  • Constructor Details

    • BungeeMessageOut

      public BungeeMessageOut(@Nonnull org.bukkit.entity.Player player, @Nonnull MessageType type)
      Create a new BungeeMessageOut to be sent. If the message type you have doesn't need additional data, you can just send it right after creating this!
      Parameters:
      player - The player you want the message to be sent through. Doesn't matter in most cases.
      type - The type of message you are going to send.
  • Method Details

    • sendMessage

      public void sendMessage()
      Makes a new data output, and writes the MessageType string and your written data to it. If you haven't written any data to this class, it won't write any additional data.
    • setPlugin

      @Deprecated public static void setPlugin(@Nonnull org.bukkit.plugin.Plugin sendingPlugin)
      Deprecated.
      For internal use only.
    • write

      public void write(int i)
      Specified by:
      write in interface com.google.common.io.ByteArrayDataOutput
      Specified by:
      write in interface DataOutput
    • write

      public void write(@Nonnull byte[] bytes)
      Specified by:
      write in interface com.google.common.io.ByteArrayDataOutput
      Specified by:
      write in interface DataOutput
    • write

      public void write(@Nonnull byte[] bytes, int i, int i1)
      Specified by:
      write in interface com.google.common.io.ByteArrayDataOutput
      Specified by:
      write in interface DataOutput
    • writeBoolean

      public void writeBoolean(boolean b)
      Specified by:
      writeBoolean in interface com.google.common.io.ByteArrayDataOutput
      Specified by:
      writeBoolean in interface DataOutput
    • writeByte

      public void writeByte(int i)
      Specified by:
      writeByte in interface com.google.common.io.ByteArrayDataOutput
      Specified by:
      writeByte in interface DataOutput
    • writeShort

      public void writeShort(int i)
      Specified by:
      writeShort in interface com.google.common.io.ByteArrayDataOutput
      Specified by:
      writeShort in interface DataOutput
    • writeChar

      public void writeChar(int i)
      Specified by:
      writeChar in interface com.google.common.io.ByteArrayDataOutput
      Specified by:
      writeChar in interface DataOutput
    • writeInt

      public void writeInt(int i)
      Specified by:
      writeInt in interface com.google.common.io.ByteArrayDataOutput
      Specified by:
      writeInt in interface DataOutput
    • writeLong

      public void writeLong(long l)
      Specified by:
      writeLong in interface com.google.common.io.ByteArrayDataOutput
      Specified by:
      writeLong in interface DataOutput
    • writeFloat

      public void writeFloat(float v)
      Specified by:
      writeFloat in interface com.google.common.io.ByteArrayDataOutput
      Specified by:
      writeFloat in interface DataOutput
    • writeDouble

      public void writeDouble(double v)
      Specified by:
      writeDouble in interface com.google.common.io.ByteArrayDataOutput
      Specified by:
      writeDouble in interface DataOutput
    • writeChars

      public void writeChars(@Nonnull String s)
      Specified by:
      writeChars in interface com.google.common.io.ByteArrayDataOutput
      Specified by:
      writeChars in interface DataOutput
    • writeUTF

      public void writeUTF(@Nonnull String s)
      Specified by:
      writeUTF in interface com.google.common.io.ByteArrayDataOutput
      Specified by:
      writeUTF in interface DataOutput
    • writeBytes

      public void writeBytes(@Nonnull String s)
      Specified by:
      writeBytes in interface com.google.common.io.ByteArrayDataOutput
      Specified by:
      writeBytes in interface DataOutput
    • toByteArray

      @Nonnull public byte[] toByteArray()
      Specified by:
      toByteArray in interface com.google.common.io.ByteArrayDataOutput