Class PlotId

java.lang.Object
com.plotsquared.core.plot.PlotId

public final class PlotId extends Object
Plot (X,Y) tuples for plot locations within a plot area
  • Method Details

    • of

      public static @NonNull PlotId of(int x, int y)
      Create a new plot ID instance
      Parameters:
      x - The plot x coordinate
      y - The plot y coordinate
      Returns:
      a new PlotId at x,y
    • fromString

      public static @NonNull PlotId fromString(@NonNull String string)
      Get a Plot Id based on a string
      Parameters:
      string - to create id from
      Returns:
      the PlotId representation of the argument
      Throws:
      IllegalArgumentException - if the string does not contain a valid PlotId
    • fromStringOrNull

      public static @Nullable PlotId fromStringOrNull(@NonNull String string)
      Attempt to parse a plot ID from a string
      Parameters:
      string - ID string
      Returns:
      Plot ID, or null if none could be parsed
    • unpair

      public static @NonNull PlotId unpair(int hash)
      Gets the PlotId from the HashCode
      Note: Only accurate for small x,z values (short)
      Parameters:
      hash - ID hash
      Returns:
      Plot ID
    • copy

      public @NonNull PlotId copy()
      Get a copy of the plot ID
      Returns:
      Plot ID copy
    • getX

      public int getX()
      Get the ID X component
      Returns:
      X component
    • getY

      public int getY()
      Get the ID Y component
      Returns:
      Y component
    • getNextId

      public @NonNull PlotId getNextId()
      Get the next plot ID for claiming purposes
      Returns:
      Next plot ID
    • getRelative

      public @NonNull PlotId getRelative(@NonNull Direction direction)
      Get the PlotId in a relative direction
      Parameters:
      direction - Direction
      Returns:
      Relative plot ID
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public @NonNull String toString()
      Get a String representation of the plot ID where the components are separated by ";"
      Overrides:
      toString in class Object
      Returns:
      x + ";" + y
    • toSeparatedString

      public @NonNull String toSeparatedString(String separator)
      Get a String representation of the plot ID where the components are separated by a specified string
      Parameters:
      separator - Separator
      Returns:
      x + separator + y
    • toCommaSeparatedString

      public @NonNull String toCommaSeparatedString()
      Get a String representation of the plot ID where the components are separated by ","
      Returns:
      x + "," + y
    • toUnderscoreSeparatedString

      public @NonNull String toUnderscoreSeparatedString()
      Get a String representation of the plot ID where the components are separated by "_"
      Returns:
      x + "_" + y
    • toDashSeparatedString

      public @NonNull String toDashSeparatedString()
      Get a String representation of the plot ID where the components are separated by "-"
      Returns:
      x + "-" + y
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object