Class ArenaPicker

java.lang.Object
de.marcely.bedwars.api.arena.picker.ArenaPicker

public class ArenaPicker extends Object
Represents the final ArenaPicker product that persists of a selector and a bunch of conditions (aka as a condition group).

Use ArenaPickerAPI.parsePicker(String) to parse it given by a String.

  • Constructor Details

  • Method Details

    • getSelector

      public ArenaSelector getSelector()
      Returns the selector.

      The selector decides which one arena shall be chosen from all the arenas that got filtered using getCondition().

      Returns:
      The selector of this picker
    • getCondition

      public ArenaConditionGroup getCondition()
      The condition filters arena.
      Returns:
      The condition of this picker
    • processLocal

      @Nullable public @Nullable Arena processLocal(Collection<Arena> arenas)
      Filters out all local arenas that do not match the conditions and gets the arena that matches the arena.

      The given collection is not being modified in any way.

      Parameters:
      arenas - The local arenas that shall be processed
      Returns:
      The matching arena. null in case all were filtered out or none matches the selector
    • processRemote

      @Nullable public @Nullable RemoteArena processRemote(Collection<? extends RemoteArena> arenas)
      Filters out all remote arenas that do not match the conditions and gets the arena that matches the arena.

      The given collection is not being modified in any way.

      Parameters:
      arenas - The remote arenas that shall be processed
      Returns:
      The matching arena. null in case all were filtered out or none matches the selector
    • processLocal

      @Nullable public @Nullable Arena processLocal()
      Filters out all local arenas that do not match the conditions and gets the arena that matches the arena.

      Uses GameAPI.getArenas() as the reference.

      Returns:
      The matching arena. null in case all were filtered out or none matches the selector
    • processRemote

      @Nullable public @Nullable RemoteArena processRemote()
      Filters out all local arenas that do not match the conditions and gets the arena that matches the arena.

      Uses RemoteAPI.getArenas() as the reference.

      Returns:
      The matching arena. null in case all were filtered out or none matches the selector
    • serialize

      public String serialize()
      Serializes a string representation that may as well be used to deserialize/parse it.
      Returns:
      A string representation of this picker
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object