1
0
mirror of https://github.com/lucko/LuckPerms.git synced 2025-09-01 18:32:33 +02:00

SpongeAPI 8 (#2728)

This commit is contained in:
lucko
2022-02-07 21:10:01 +00:00
committed by GitHub
parent d3029a8467
commit ee79f53612
70 changed files with 1301 additions and 1707 deletions

View File

@@ -29,6 +29,7 @@ import com.github.benmanes.caffeine.cache.LoadingCache;
import me.lucko.luckperms.bungee.LPBungeePlugin;
import me.lucko.luckperms.common.context.manager.ContextManager;
import me.lucko.luckperms.common.context.manager.InlineQueryOptionsSupplier;
import me.lucko.luckperms.common.context.manager.QueryOptionsSupplier;
import me.lucko.luckperms.common.util.CaffeineFactory;
@@ -60,9 +61,10 @@ public class BungeeContextManager extends ContextManager<ProxiedPlayer, ProxiedP
throw new NullPointerException("subject");
}
return new InlineQueryOptionsSupplier(subject, this.contextsCache);
return new InlineQueryOptionsSupplier<>(subject, this.contextsCache);
}
// override getContext, getQueryOptions and invalidateCache to skip the QueryOptionsSupplier
@Override
public ImmutableContextSet getContext(ProxiedPlayer subject) {
return getQueryOptions(subject).context();
@@ -83,18 +85,4 @@ public class BungeeContextManager extends ContextManager<ProxiedPlayer, ProxiedP
return formQueryOptions(contextSet);
}
private static final class InlineQueryOptionsSupplier implements QueryOptionsSupplier {
private final ProxiedPlayer key;
private final LoadingCache<ProxiedPlayer, QueryOptions> cache;
private InlineQueryOptionsSupplier(ProxiedPlayer key, LoadingCache<ProxiedPlayer, QueryOptions> cache) {
this.key = key;
this.cache = cache;
}
@Override
public QueryOptions getQueryOptions() {
return this.cache.get(this.key);
}
}
}