use of me.lucko.luckperms.common.model.User 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.common.model.User in project LuckPerms by lucko.
the class VaultChatHook method setUserChatPrefix.
@Override
public void setUserChatPrefix(String world, UUID uuid, String prefix) {
if (uuid == null) {
return;
}
User user = getUser(uuid);
if (user == null) {
return;
}
setChatMeta(user, ChatMetaType.PREFIX, prefix, world);
}
use of me.lucko.luckperms.common.model.User in project LuckPerms by lucko.
the class VaultPermissionHook method userAddPermission.
@Override
public boolean userAddPermission(String world, UUID uuid, String permission) {
if (uuid == null) {
return false;
}
Objects.requireNonNull(permission, "permission");
User user = getUser(uuid);
if (user == null) {
return false;
}
holderAddPermission(user, permission, world);
return true;
}
use of me.lucko.luckperms.common.model.User 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();
}
use of me.lucko.luckperms.common.model.User in project LuckPerms by lucko.
the class BungeeConnectionListener method onPlayerPostLogin.
@EventHandler
public void onPlayerPostLogin(PostLoginEvent e) {
final ProxiedPlayer player = e.getPlayer();
final User user = this.plugin.getUserManager().getIfLoaded(e.getPlayer().getUniqueId());
if (this.plugin.getConfiguration().get(ConfigKeys.DEBUG_LOGINS)) {
this.plugin.getLogger().info("Processing post-login for " + player.getUniqueId() + " - " + player.getName());
}
if (user == null) {
if (this.plugin.getConfiguration().get(ConfigKeys.CANCEL_FAILED_LOGINS)) {
// disconnect the user
this.plugin.getLogger().warn("User " + player.getUniqueId() + " - " + player.getName() + " doesn't have data pre-loaded - cancelling login.");
e.getPlayer().disconnect(TextComponent.fromLegacyText(Message.LOADING_ERROR.asString(this.plugin.getLocaleManager())));
} else {
// just send a message
this.plugin.getBootstrap().getProxy().getScheduler().schedule(this.plugin.getBootstrap(), () -> {
if (!player.isConnected()) {
return;
}
player.sendMessage(TextComponent.fromLegacyText(Message.LOADING_ERROR.asString(this.plugin.getLocaleManager())));
}, 1, TimeUnit.SECONDS);
}
}
}
Aggregations