Package com.plotsquared.core.plot
Class PlotId
java.lang.Object
com.plotsquared.core.plot.PlotId
The PlotId class represents a Plot's x and y coordinates within a
PlotArea. PlotId x,y values do not correspond to Block locations.
A PlotId instance can be created using the of(int, int) method or parsed from a string using the fromString(String) method.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAn iterator that iterates over a range ofPlotIds. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic @NonNull PlotIdfromString(@NonNull String string) Get a Plot Id based on a stringstatic @Nullable PlotIdfromStringOrNull(@NonNull String string) Returns a PlotId object from the given string, or null if the string is invalid.@NonNull PlotIdReturns the next Plot ID for claiming purposes based on the current Plot ID.@NonNull PlotIdgetRelative(@NonNull Direction direction) Returns a new Plot ID in the specified relative direction based on the current Plot ID.intgetX()Returns the x-coordinate of this Plot ID.intgetY()Returns the y-coordinate of this Plot ID.inthashCode()static @NonNull PlotIdof(int x, int y) Returns a new PlotId instance with the specified x and y coordinates.@NonNull StringReturns a string representation of this Plot ID in the format "x,y".@NonNull StringReturns a string representation of this Plot ID in the format "x-y".@NonNull StringtoSeparatedString(String separator) Returns a string representation of this Plot ID with the specified separator.@NonNull StringtoString()Returns a string representation of this Plot ID in the format "x;y".@NonNull StringReturns a string representation of this Plot ID in the format "x_y".static @NonNull PlotIdunpair(int hash) Returns a new PlotId instance from the given hash.
-
Method Details
-
of
Returns a new PlotId instance with the specified x and y coordinates.- Parameters:
x- the x-coordinate of the ploty- the y-coordinate of the plot- Returns:
- a new PlotId instance with the specified x and y coordinates
-
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
Returns a PlotId object from the given string, or null if the string is invalid. The string should be in the format "x;y" where x and y are integers. The string can also contain any combination of the characters ";_,." as delimiters.- Parameters:
string- the string to parse- Returns:
- a PlotId object parsed from the given string, or null if the string is invalid
-
unpair
Returns a new PlotId instance from the given hash.- Parameters:
hash- the hash to unpair- Returns:
- a new PlotId instance
-
getX
Returns the x-coordinate of this Plot ID.- Returns:
- the x-coordinate of this Plot ID
-
getY
Returns the y-coordinate of this Plot ID.- Returns:
- the y-coordinate of this Plot ID
-
getNextId
Returns the next Plot ID for claiming purposes based on the current Plot ID.- Returns:
- the next Plot ID
-
getRelative
Returns a new Plot ID in the specified relative direction based on the current Plot ID.- Parameters:
direction- the direction in which to get the relative Plot ID- Returns:
- the relative Plot ID
-
equals
-
toString
Returns a string representation of this Plot ID in the format "x;y".The format is
x + ";" + y -
toSeparatedString
Returns a string representation of this Plot ID with the specified separator.The format is
x + separator + y- Parameters:
separator- the separator to use between the X and Y coordinates- Returns:
- a string representation of this Plot ID with the specified separator
-
toCommaSeparatedString
Returns a string representation of this Plot ID in the format "x,y".- Returns:
- a string representation of this Plot ID
-
toUnderscoreSeparatedString
Returns a string representation of this Plot ID in the format "x_y".- Returns:
- a string representation of this Plot ID
-
toDashSeparatedString
Returns a string representation of this Plot ID in the format "x-y".- Returns:
- a string representation of this Plot ID
-
hashCode
-