use of me.lucko.luckperms.api.Contexts in project LuckPerms by lucko.
the class VaultChatHook method getUserMeta.
@Override
public String getUserMeta(String world, UUID uuid, String key) {
if (uuid == null) {
return null;
}
Objects.requireNonNull(key, "key");
User user = getUser(uuid);
if (user == null) {
return null;
}
Contexts contexts = this.permissionHook.contextForLookup(user, world);
MetaCache metaData = user.getCachedData().getMetaData(contexts);
String ret = metaData.getMeta().get(key);
if (log()) {
logMsg("#getUserMeta: %s - %s - %s - %s", user.getFriendlyName(), contexts.getContexts().toMultimap(), key, ret);
}
return ret;
}
use of me.lucko.luckperms.api.Contexts in project LuckPerms by lucko.
the class VaultChatHook method getGroupChatSuffix.
@Override
public String getGroupChatSuffix(String world, String name) {
Objects.requireNonNull(name, "name");
Group group = getGroup(name);
if (group == null) {
return null;
}
Contexts contexts = this.permissionHook.contextForLookup(null, world);
MetaCache metaData = group.getCachedData().getMetaData(contexts);
String ret = metaData.getSuffix();
if (log()) {
logMsg("#getGroupSuffix: %s - %s - %s", group.getName(), contexts.getContexts().toMultimap(), ret);
}
return Strings.nullToEmpty(ret);
}
use of me.lucko.luckperms.api.Contexts in project LuckPerms by lucko.
the class VaultChatHook method getUserChatPrefix.
@Override
public String getUserChatPrefix(String world, UUID uuid) {
if (uuid == null) {
return null;
}
User user = getUser(uuid);
if (user == null) {
return null;
}
Contexts contexts = this.permissionHook.contextForLookup(user, world);
MetaCache metaData = user.getCachedData().getMetaData(contexts);
String ret = metaData.getPrefix();
if (log()) {
logMsg("#getUserChatPrefix: %s - %s - %s", user.getFriendlyName(), contexts.getContexts().toMultimap(), ret);
}
return Strings.nullToEmpty(ret);
}
use of me.lucko.luckperms.api.Contexts in project LuckPerms by lucko.
the class VaultChatHook method getUserChatSuffix.
@Override
public String getUserChatSuffix(String world, UUID uuid) {
if (uuid == null) {
return null;
}
User user = getUser(uuid);
if (user == null) {
return null;
}
Contexts contexts = this.permissionHook.contextForLookup(user, world);
MetaCache metaData = user.getCachedData().getMetaData(contexts);
String ret = metaData.getSuffix();
if (log()) {
logMsg("#getUserChatSuffix: %s - %s - %s", user.getFriendlyName(), contexts.getContexts().toMultimap(), ret);
}
return Strings.nullToEmpty(ret);
}
use of me.lucko.luckperms.api.Contexts in project LuckPerms by lucko.
the class VaultPermissionHook method userHasPermission.
@Override
public boolean userHasPermission(String world, UUID uuid, String permission) {
if (uuid == null) {
return false;
}
Objects.requireNonNull(permission, "permission");
User user = getUser(uuid);
if (user == null) {
return false;
}
Contexts contexts = contextForLookup(user, world);
PermissionCache permissionData = user.getCachedData().getPermissionData(contexts);
Tristate result = permissionData.getPermissionValue(permission, CheckOrigin.INTERNAL);
if (log()) {
logMsg("#userHasPermission: %s - %s - %s - %s", user.getFriendlyName(), contexts.getContexts().toMultimap(), permission, result);
}
return result.asBoolean();
}
Aggregations