net.luckperms.api.cacheddata.CachedMetaData Java Examples
The following examples show how to use
net.luckperms.api.cacheddata.CachedMetaData.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LuckPermsProvider.java From GriefDefender with MIT License | 6 votes |
public Map<String, String> getOptions(GDPermissionHolder holder, Set<Context> contexts) { ImmutableContextSet set = this.getLPContexts(contexts).immutableCopy(); final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder); if (permissionHolder == null) { return new HashMap<>(); } final QueryOptions query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).context(set).build(); CachedMetaData cachedData = permissionHolder.getCachedData().getMetaData(query); // TODO Map<String, String> metaMap = new HashMap<>(); for (Map.Entry<String, List<String>> mapEntry : cachedData.getMeta().entrySet()) { metaMap.put(mapEntry.getKey(), mapEntry.getValue().get(0)); } return metaMap; }
Example #2
Source File: LuckPermsProvider.java From GriefDefender with MIT License | 6 votes |
@Override public List<String> getOptionValueList(GDPermissionHolder holder, Option option, Set<Context> contexts) { // If no server context exists, add global this.checkServerContext(contexts); ImmutableContextSet set = this.getLPContexts(contexts).immutableCopy(); final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder); if (permissionHolder == null) { return null; } final QueryOptions query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).context(set).build(); CachedMetaData metaData = permissionHolder.getCachedData().getMetaData(query); List<String> list = metaData.getMeta().get(option.getPermission()); if (list == null) { return new ArrayList<>(); } return list; }
Example #3
Source File: LuckPermsProvider.java From GriefDefender with MIT License | 6 votes |
public Map<String, String> getOptions(GDPermissionHolder holder, Set<Context> contexts) { ImmutableContextSet set = this.getLPContexts(contexts).immutableCopy(); final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder); if (permissionHolder == null) { return new HashMap<>(); } final QueryOptions query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).context(set).build(); CachedMetaData cachedData = permissionHolder.getCachedData().getMetaData(query); // TODO Map<String, String> metaMap = new HashMap<>(); for (Map.Entry<String, List<String>> mapEntry : cachedData.getMeta().entrySet()) { metaMap.put(mapEntry.getKey(), mapEntry.getValue().get(0)); } return metaMap; }
Example #4
Source File: LuckPermsProvider.java From GriefDefender with MIT License | 6 votes |
@Override public List<String> getOptionValueList(GDPermissionHolder holder, Option option, Set<Context> contexts) { // If no server context exists, add global this.checkServerContext(contexts); ImmutableContextSet set = this.getLPContexts(contexts).immutableCopy(); final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder); if (permissionHolder == null) { return null; } final QueryOptions query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).context(set).build(); CachedMetaData metaData = permissionHolder.getCachedData().getMetaData(query); List<String> list = metaData.getMeta().get(option.getPermission()); if (list == null) { return new ArrayList<>(); } return list; }
Example #5
Source File: LuckPermsProvider.java From GriefDefender with MIT License | 5 votes |
@Override public String getOptionValue(GDPermissionHolder holder, Option option, Set<Context> contexts) { // If no server context exists, add global this.checkServerContext(contexts); ImmutableContextSet set = this.getLPContexts(contexts).immutableCopy(); final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder); if (permissionHolder == null) { return null; } final QueryOptions query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).context(set).build(); CachedMetaData metaData = permissionHolder.getCachedData().getMetaData(query); return metaData.getMetaValue(option.getPermission()); }
Example #6
Source File: LuckPermsProvider.java From GriefDefender with MIT License | 5 votes |
@Override public String getOptionValue(GDPermissionHolder holder, Option option, Set<Context> contexts) { // If no server context exists, add global this.checkServerContext(contexts); ImmutableContextSet set = this.getLPContexts(contexts).immutableCopy(); final PermissionHolder permissionHolder = this.getLuckPermsHolder(holder); if (permissionHolder == null) { return null; } final QueryOptions query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).context(set).build(); CachedMetaData metaData = permissionHolder.getCachedData().getMetaData(query); return metaData.getMetaValue(option.getPermission()); }
Example #7
Source File: LuckPerms5Hook.java From BungeeChat2 with GNU General Public License v3.0 | 5 votes |
private Optional<CachedMetaData> getMetaData(BungeeChatAccount account) { final Optional<User> user = Optional.ofNullable(api.getUserManager().getUser(account.getUniqueId())); return user.map(User::getCachedData) .map(data -> data.getMetaData(getQueryOptions(user))) .filter(Objects::nonNull); }
Example #8
Source File: LuckPerms5Hook.java From BungeeChat2 with GNU General Public License v3.0 | 4 votes |
@Override public Optional<String> getPrefix(BungeeChatAccount account) { return getMetaData(account).map(CachedMetaData::getPrefix).filter(Objects::nonNull); }
Example #9
Source File: LuckPerms5Hook.java From BungeeChat2 with GNU General Public License v3.0 | 4 votes |
@Override public Optional<String> getSuffix(BungeeChatAccount account) { return getMetaData(account).map(CachedMetaData::getSuffix).filter(Objects::nonNull); }
Example #10
Source File: AbstractCachedDataManager.java From LuckPerms with MIT License | 4 votes |
@Override public @NonNull Container<CachedMetaData> metaData() { return this.meta; }
Example #11
Source File: PlayerAdapter.java From LuckPerms with MIT License | 2 votes |
/** * Gets the current {@link CachedMetaData} for the {@code player}, * using their {@link #getQueryOptions(Object) active query options}. * * @param player the player * @return the cached meta data for the player * @see CachedDataManager#getMetaData() */ default @NonNull CachedMetaData getMetaData(@NonNull T player) { return getUser(player).getCachedData().getMetaData(getQueryOptions(player)); }