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

      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

      @Deprecated(forRemoval=true, since="6.10.2") public @NonNull PlotId copy()
      Deprecated, for removal: This API element is subject to removal in a future version.
      PlotId is immutable, copy is not required.
      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

      Get the next plot ID for claiming purposes
      Returns:
      Next plot ID
    • getRelative

      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

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

      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

      Get a String representation of the plot ID where the components are separated by ","
      Returns:
      x + "," + y
    • toUnderscoreSeparatedString

      Get a String representation of the plot ID where the components are separated by "_"
      Returns:
      x + "_" + y
    • 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