Class ItemPlatform<I extends AbstractItemStack<S>,S,U>

java.lang.Object
net.tnemc.item.platform.ItemPlatform<I,S,U>
Type Parameters:
I - The implementation's instance of AbstractItemStack
S - The implementation's instance of item stacks.
U - The implementation's instace of inventories.
Direct Known Subclasses:
BukkitItemPlatform, PaperItemPlatform

public abstract class ItemPlatform<I extends AbstractItemStack<S>,S,U> extends Object
ItemPlatform
Since:
0.2.0.0
Author:
creatorfromhell
  • Constructor Details

  • Method Details

    • createStack

      public abstract I createStack(String material)
      Creates a new stack based on the given material.
      Parameters:
      material - The material used for creating the stack.
      Returns:
      The newly created stack.
      Since:
      0.2.0.0
    • version

      public abstract String version()
      Returns:
      the version that is being used currently
      Since:
      0.2.0.0
    • addDefaults

      public abstract void addDefaults()
      Adds default configurations or settings to be used by the implementing class.
      Since:
      0.2.0.0
    • converter

      Retrieves the platform converter associated with the current item platform.
      Returns:
      The PlatformConverter instance used by the item platform.
      Since:
      0.2.0.0
    • defaultProvider

      @NotNull public abstract @NotNull ItemProvider<S> defaultProvider()
      Retrieves the default provider for the item stack comparison.
      Returns:
      the default provider for the item stack comparison.
      Since:
      0.2.0.0
    • defaultProviderIdentifier

      @NotNull public abstract @NotNull String defaultProviderIdentifier()
      Retrieves the identifier of the default provider for the item stack comparison.
      Returns:
      The identifier of the default provider for the item stack comparison.
      Since:
      0.2.0.0
    • calculations

      public abstract CalculationsProvider<I,S,U> calculations()
      Provides access to the calculations provider for performing various platform-specific operations.
      Returns:
      An instance of CalculationsProvider that handles calculations related to the item platform.
      Since:
      0.2.0.0
    • providerApplies

      public boolean providerApplies(AbstractItemStack<? extends S> serialized, S item)
      Checks if any of the registered item providers are applicable to the given serialized item and item.
      Parameters:
      serialized - The serialized item stack to check against.
      item - The item to check for applicability.
      Returns:
      True if an item provider is found that applies to the serialized item and item, otherwise false.
      Since:
      0.2.0.0
    • provider

      public ItemProvider<S> provider(String itemProvider)
      Retrieves the item provider for the given itemProvider name, or returns the default provider if not found.
      Parameters:
      itemProvider - The name of the ItemProvider to retrieve.
      Returns:
      The ItemProvider associated with the itemProvider name, or the default provider if not found.
      Since:
      0.2.0.0
    • addItemProvider

      public void addItemProvider(ItemProvider<S> provider)
      Adds an ItemProvider to the ItemPlatform.
      Parameters:
      provider - The ItemProvider to add to the platform
      Since:
      0.2.0.0
    • addPersistentDataType

      public void addPersistentDataType(String identifier, @NotNull @NotNull Class<? extends PersistentDataType<?>> type)
      Adds a persistent data type to the item platform.
      Parameters:
      identifier - The identifier for the persistent data type.
      type - The class representing the persistent data type.
      Since:
      0.2.0.0
    • getClasses

      public Map<String,Class<? extends PersistentDataType<?>>> getClasses()
    • addMulti

      public void addMulti(@NotNull @NotNull Object object)
      Used to add an object that is capable of being dual/tri purpose as a check, applicator and/or deserializer.
      Parameters:
      object - the object to add.
      Since:
      0.2.0.0
    • locale

      public abstract I locale(S locale)
      Converts the given locale stack to an instance of AbstractItemStack
      Parameters:
      locale - the locale to convert
      Returns:
      the converted locale of type I
      Since:
      0.2.0.0
    • addCheck

      public void addCheck(@NotNull @NotNull ItemCheck<S> check)
      Parameters:
      check - the check to add.
      Since:
      0.2.0.0
    • addApplicator

      public void addApplicator(@NotNull @NotNull ItemApplicator<I,S> applicator)
      Parameters:
      applicator - the applicator to add
      Since:
      0.2.0.0
    • addSerializer

      public void addSerializer(@NotNull @NotNull ItemSerializer<I,S> serializer)
      Parameters:
      serializer - the deserializer to add
      Since:
      0.2.0.0
    • addEffect

      public void addEffect(@NotNull @NotNull ComponentEffect effect)
      Adds a ReviveEffect to the reviveEffects map.
      Parameters:
      effect - The ReviveEffect instance to add. Must not be null.
      Since:
      0.2.0.0
    • check

      public boolean check(@NotNull S original, @NotNull S check, @NotNull @NotNull String... disabledChecks)
      Used to check if two locale stacks are comparable. How they are performed: - if a locale check applies, the check result is returned, true is the default return.
      Parameters:
      original - the original stack
      check - the stack to use for the check
      disabledChecks - the Identifiable.identifier() check identifiers that should be disabled for the check.
      Returns:
      True if the check passes, otherwise false.
      Since:
      0.2.0.0
    • checkOrder

      public boolean checkOrder(@NotNull S original, @NotNull S check, @NotNull @NotNull String... order)
      Used to check if two locale stacks are comparable based on a specific order of checks.
      Parameters:
      original - the original stack
      check - the stack to use for the check
      order - the order of the checks to run for the comparison
      Returns:
      True if the check passes, otherwise false.
      Since:
      0.2.0.0
    • check

      public boolean check(@NotNull I original, @NotNull I check, String... disabledChecks)
      Used to check if two serialized stacks are comparable.
      Parameters:
      original - the original stack
      check - the stack to use for the check
      disabledChecks - the Identifiable.identifier() check identifiers that should be disabled for the check.
      Returns:
      True if the check passes, otherwise false.
      Since:
      0.2.0.0
    • checkOrder

      public boolean checkOrder(@NotNull I original, @NotNull I check, @NotNull @NotNull String... order)
      Used to check if two serialized stacks are comparable based on a specific order of checks.
      Parameters:
      original - the original stack
      check - the stack to use for the check
      order - the order of the checks to run for the comparison
      Returns:
      True if the check passes, otherwise false.
      Since:
      0.2.0.0
    • apply

      public S apply(@NotNull I serialized, @NotNull S item)
      Applies all enabled applicators to the given item.
      Parameters:
      serialized - the serialized item stack to use
      item - the locale itemstack object to apply the applications to
      Returns:
      the updated item stack after applying the applicators
      Since:
      0.2.0.0
    • serializer

      public I serializer(@NotNull S item, @NotNull I serialized)
      Applies all enabled serializers to the given item.
      Parameters:
      item - the item that we should use to serialize.
      serialized - the serialized item stack we should use to apply this serializer to
      Returns:
      the updated serialized item.
      Since:
      0.2.0.0
    • initSerialized

      public abstract Optional<I> initSerialized(org.json.simple.JSONObject object)
      Initializes and returns an AbstractItemStack object by deserializing the provided JSON object.
      Parameters:
      object - the JSON object to deserialize
      Returns:
      an initialized AbstractItemStack object
      Since:
      0.2.0.0
    • componentString

      public static String componentString(@NotNull @NotNull net.kyori.adventure.text.Component component)
    • effects

      public Map<String,Class<? extends ComponentEffect>> effects()