Interface IDataWriter


@NonExtendable public interface IDataWriter
Used to sync data.
  • Method Details

    • raw

      Modify raw NBT data to be synced.

      Note: use a unique property name, as it can conflict with data from other plugins.

      For more complex data, use typed data instead.

    • add

      <D extends IData> void add(IData.Type<D> type, Consumer<IDataWriter.Result<D>> consumer)
      Adds a typed data.

      For simple data, consider using raw NBT data instead, as it is easier to do and enough for most purpose.

      Parameters:
      type - the type of the data
      consumer - the consumer that will be called if necessary based on the provider priority. If earlier provider already added the data, or decided to block other provider, this will not be called.
      See Also:
    • addImmediate

      void addImmediate(IData data)
      Immediately adds a typed data.

      Use this method only for internal data that only you use, otherwise use add(IData.Type, Consumer) instead.

      Parameters:
      data - the data to add
      Throws:
      IllegalStateException - if the data is already added, whether with add(IData.Type, Consumer) or this method
    • blockAll

      default void blockAll(IData.Type<? extends IData> type)
      Blocks all lower priority provider unconditionally.
      Parameters:
      type - the type of the data that wanted to be blocked