mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-24 18:19:03 +01:00
Fixed ProtectedRegion.compareTo.
It properly implements the Comparable interface now. In particular, it now fulfills the criterion "sgn(x.compareTo(y)) == -sgn(y.compareTo(x))".
This commit is contained in:
parent
46a2510e85
commit
9d848e222b
@ -414,21 +414,22 @@ public boolean containsAny(List<BlockVector2D> pts) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares to another region.
|
||||
* Compares to another region.<br>
|
||||
*<br>
|
||||
* Orders primarily by the priority, descending<br>
|
||||
* Orders secondarily by the id, ascending
|
||||
*
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
public int compareTo(ProtectedRegion other) {
|
||||
if (id.equals(other.id)) {
|
||||
return 0;
|
||||
} else if (priority == other.priority) {
|
||||
return 1;
|
||||
} else if (priority > other.priority) {
|
||||
if (priority > other.priority) {
|
||||
return -1;
|
||||
} else {
|
||||
} else if (priority < other.priority) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return id.compareTo(other.id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user