[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,8 +79,26 @@ public void delete(UncompletedProfile profile) {
@Override @Override
public Set<UncompletedProfile> getProfiles(Client client) { public Set<UncompletedProfile> getProfiles(Client client) {
if(client == null) {
return new HashSet<>(profilesMap.values()); 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 @Override
public CompletedProfile pushUpdate(UncompletedProfile profile, String tag, ClientProfile clientProfile, List<ProfileAction> assetActions, List<ProfileAction> clientActions, List<UpdateFlag> flags) throws IOException { public CompletedProfile pushUpdate(UncompletedProfile profile, String tag, ClientProfile clientProfile, List<ProfileAction> assetActions, List<ProfileAction> clientActions, List<UpdateFlag> flags) throws IOException {