Package com.plotsquared.core.plot
Class PlotId
java.lang.Object
com.plotsquared.core.plot.PlotId
Plot (X,Y) tuples for plot locations
within a plot area
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescription@NonNull PlotIdcopy()Get a copy of the plot IDbooleanstatic @NonNull PlotIdfromString(@NonNull String string)Get a Plot Id based on a stringstatic @Nullable PlotIdfromStringOrNull(@NonNull String string)Attempt to parse a plot ID from a string@NonNull PlotIdGet the next plot ID for claiming purposes@NonNull PlotIdgetRelative(@NonNull Direction direction)Get the PlotId in a relative directionintgetX()Get the ID X componentintgetY()Get the ID Y componentinthashCode()static @NonNull PlotIdof(int x, int y)Create a new plot ID instance@NonNull StringGet a String representation of the plot ID where the components are separated by ","@NonNull StringGet a String representation of the plot ID where the components are separated by "-"@NonNull StringtoSeparatedString(String separator)Get a String representation of the plot ID where the components are separated by a specified string@NonNull StringtoString()Get a String representation of the plot ID where the components are separated by ";"@NonNull StringGet a String representation of the plot ID where the components are separated by "_"static @NonNull PlotIdunpair(int hash)Gets the PlotId from the HashCode
Note: Only accurate for small x,z values (short)
-
Method Details
-
of
Create a new plot ID instance- Parameters:
x- The plot x coordinatey- The plot y coordinate- Returns:
- a new PlotId at x,y
-
fromString
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
nullif none could be parsed
-
unpair
Gets the PlotId from the HashCode
Note: Only accurate for small x,z values (short)- Parameters:
hash- ID hash- Returns:
- Plot ID
-
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
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
-
toString
Get a String representation of the plot ID where the components are separated by ";" -
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()
-