Position without principal section

This commit is contained in:
Jaime Martinez Rincon 2017-02-18 02:06:45 +01:00
parent 7a49c4e31d
commit 88a55271d5
2 changed files with 17 additions and 10 deletions

View File

@ -99,7 +99,11 @@ public class SectionManager {
return principal;
}
protected void setPrincipal(ServerSection principal) {
void setPrincipal(ServerSection principal) {
this.principal = principal;
}
boolean hasPrincipal() {
return principal != null;
}
}

View File

@ -124,18 +124,21 @@ public class ServerSection {
}
//Calculate below principal
iterations = 0;
current = plugin.getSectionManager().getPrincipal();
while (current != null) {
if (current.equals(this)) {
return iterations;
}
if (plugin.getSectionManager().hasPrincipal()) {
iterations = 0;
current = plugin.getSectionManager().getPrincipal();
while (current != null) {
if (current.equals(this)) {
return iterations;
}
current = current.getParent();
iterations--;
current = current.getParent();
iterations--;
}
}
return 0;
//Returns iterations above parents
return iterations;
};
try {