minecraft-src/net/minecraft/server/players/ServerOpList.java
2025-07-04 01:41:11 +03:00

34 lines
985 B
Java

package net.minecraft.server.players;
import com.google.gson.JsonObject;
import com.mojang.authlib.GameProfile;
import java.io.File;
import java.util.Objects;
public class ServerOpList extends StoredUserList<GameProfile, ServerOpListEntry> {
public ServerOpList(File file) {
super(file);
}
@Override
protected StoredUserEntry<GameProfile> createEntry(JsonObject entryData) {
return new ServerOpListEntry(entryData);
}
@Override
public String[] getUserList() {
return (String[])this.getEntries().stream().map(StoredUserEntry::getUser).filter(Objects::nonNull).map(GameProfile::getName).toArray(String[]::new);
}
public boolean canBypassPlayerLimit(GameProfile profile) {
ServerOpListEntry serverOpListEntry = this.get(profile);
return serverOpListEntry != null ? serverOpListEntry.getBypassesPlayerLimit() : false;
}
/**
* Gets the key value for the given object
*/
protected String getKeyForUser(GameProfile obj) {
return obj.getId().toString();
}
}