mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Hows this?
This commit is contained in:
parent
12c476f3c2
commit
c606b4d893
@ -288,12 +288,26 @@ public class Plot implements Cloneable {
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int
|
||||
x = getId().x,
|
||||
z = getId().y;
|
||||
String
|
||||
xL = (x + "").length() + "",
|
||||
zL = (z + "").length() + "";
|
||||
return Integer.parseInt(xL + x + zL + z);
|
||||
int x = id.x;
|
||||
int y = id.y;
|
||||
if (x >= 0) {
|
||||
if (y >= 0) {
|
||||
return x*x + 3*x + 2*x*y + y + y*y;
|
||||
}
|
||||
else {
|
||||
int y1 = -y;
|
||||
return x*x + 3*x + 2*x*y1 + y1 + y1*y1 + 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
int x1 = -x;
|
||||
if (y >= 0) {
|
||||
return -(x1*x1 + 3*x1 + 2*x1*y + y + y*y);
|
||||
}
|
||||
else {
|
||||
int y1 = -y;
|
||||
return -(x1*x1 + 3*x1 + 2*x1*y1 + y1 + y1*y1 + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,10 +45,24 @@ public class PlotId {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = (prime * result) + this.x;
|
||||
result = (prime * result) + this.y;
|
||||
return result;
|
||||
if (x >= 0) {
|
||||
if (y >= 0) {
|
||||
return x*x + 3*x + 2*x*y + y + y*y;
|
||||
}
|
||||
else {
|
||||
int y1 = -y;
|
||||
return x*x + 3*x + 2*x*y1 + y1 + y1*y1 + 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
int x1 = -x;
|
||||
if (y >= 0) {
|
||||
return -(x1*x1 + 3*x1 + 2*x1*y + y + y*y);
|
||||
}
|
||||
else {
|
||||
int y1 = -y;
|
||||
return -(x1*x1 + 3*x1 + 2*x1*y1 + y1 + y1*y1 + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user