Class SearchPattern

java.lang.Object
io.github.rysefoxx.inventory.plugin.pattern.SearchPattern

public class SearchPattern extends Object
Since:
6/11/2022
  • Constructor Details

  • Method Details

    • define

      public void define(String @NotNull ... lines) throws IllegalArgumentException
      Defines the pattern to be searched for.
      Parameters:
      lines - The lines of the pattern.
      Throws:
      IllegalArgumentException - If the line length is not 9.
    • define

      public void define(@NotNull @NotNull String line, @Nonnegative int amount) throws IllegalArgumentException
      Defines the pattern to be searched for.
      Parameters:
      line - The line of the pattern.
      amount - How often this pattern should be repeated.
      Throws:
      IllegalArgumentException - If the line length is not 9 or the amount is higher than 6.
    • searchForIntelligentItems

      @NotNull public @NotNull List<IntelligentItem> searchForIntelligentItems(char frame) throws IllegalStateException
      Method to search all IntelligentItems based on the frame.
      Parameters:
      frame - The frame to search for.
      Returns:
      A list of IntelligentItems that match the frame.
      Throws:
      IllegalStateException - If no pattern have been defined.
    • searchForItemStacks

      @NotNull public @NotNull List<org.bukkit.inventory.ItemStack> searchForItemStacks(char frame) throws IllegalStateException
      Method to search all ItemStacks based on the frame.
      Parameters:
      frame - The frame to search for.
      Returns:
      A list of IntelligentItems that match the frame.
      Throws:
      IllegalStateException - If no pattern have been defined.
    • getPattern

      @NotNull public @Unmodifiable @NotNull List<String> getPattern() throws UnsupportedOperationException
      Returns:
      The pattern specified in the define(String...) method.
      Throws:
      UnsupportedOperationException - If list gets modified.