Skip to content

Commit

Permalink
modernize has_permission tag
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Sep 25, 2019
1 parent 30ce47f commit a3e5406
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -1557,7 +1557,7 @@ public ObjectTag run(Attribute attribute, ObjectTag object) {
return null;
}

return new ElementTag(Depends.permissions.has((World) null, ((PlayerTag) object).getName(), permission)) // TODO: Vault UUID support?
return new ElementTag(Depends.permissions.playerHas(null, ((PlayerTag) object).getOfflinePlayer(), permission))
.getObjectAttribute(attribute.fulfill(2));
}

Expand All @@ -1580,7 +1580,7 @@ else if (attribute.getAttribute(2).startsWith("world")) {
return null;
}

return new ElementTag(Depends.permissions.has(attribute.getContext(2), ((PlayerTag) object).getName(), permission)) // TODO: Vault UUID support?
return new ElementTag(Depends.permissions.playerHas(attribute.getContext(2), ((PlayerTag) object).getOfflinePlayer(), permission))
.getObjectAttribute(attribute.fulfill(2));
}

Expand All @@ -1589,6 +1589,10 @@ else if (((PlayerTag) object).isOnline()) {
return new ElementTag(((PlayerTag) object).getPlayerEntity().hasPermission(permission))
.getObjectAttribute(attribute.fulfill(1));
}
else if (Depends.permissions != null) {
return new ElementTag(Depends.permissions.playerHas(null, ((PlayerTag) object).getOfflinePlayer(), permission))
.getObjectAttribute(attribute.fulfill(1));
}
return null;
}
});
Expand Down

0 comments on commit a3e5406

Please sign in to comment.