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
-
Method Summary
Modifier and TypeMethodDescription@NonNull PlotId
copy()
Get a copy of the plot IDboolean
static @NonNull PlotId
fromString(@NonNull String string)
Get a Plot Id based on a stringstatic @Nullable PlotId
fromStringOrNull(@NonNull String string)
Attempt to parse a plot ID from a string@NonNull PlotId
Get the next plot ID for claiming purposes@NonNull PlotId
getRelative(@NonNull Direction direction)
Get the PlotId in a relative directionint
getX()
Get the ID X componentint
getY()
Get the ID Y componentint
hashCode()
static @NonNull PlotId
of(int x, int y)
Create a new plot ID instance@NonNull String
Get a String representation of the plot ID where the components are separated by ","@NonNull String
Get a String representation of the plot ID where the components are separated by "-"@NonNull String
toSeparatedString(String separator)
Get a String representation of the plot ID where the components are separated by a specified string@NonNull String
toString()
Get a String representation of the plot ID where the components are separated by ";"@NonNull String
Get a String representation of the plot ID where the components are separated by "_"static @NonNull PlotId
unpair(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
null
if 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()
-