[FIX] Support profile limited

This commit is contained in:
Gravita 2025-06-22 17:58:34 +07:00
parent 183d0fc9df
commit 68e2230d34

View file

@ -79,7 +79,25 @@ public void delete(UncompletedProfile profile) {
@Override
public Set<UncompletedProfile> getProfiles(Client client) {
return new HashSet<>(profilesMap.values());
if(client == null) {
return new HashSet<>(profilesMap.values());
}
if(!client.isAuth) {
return new HashSet<>();
}
Set<UncompletedProfile> profiles = new HashSet<>();
for(var p : profilesMap.entrySet()) {
var uuid = p.getKey();
var profile = p.getValue();
if(profile.getProfile() != null && profile.getProfile().isLimited()) {
if(client.isAuth && client.permissions != null && client.permissions.hasPerm(String.format("launchserver.profile.%s.show", uuid))) {
profiles.add(profile);
}
} else {
profiles.add(profile);
}
}
return profiles;
}
@Override