• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java User类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中me.lucko.luckperms.api.User的典型用法代码示例。如果您正苦于以下问题:Java User类的具体用法?Java User怎么用?Java User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



User类属于me.lucko.luckperms.api包,在下文中一共展示了User类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getPrefix

import me.lucko.luckperms.api.User; //导入依赖的package包/类
static String getPrefix(ProxiedPlayer p) {
    if (ProxyServer.getInstance().getPluginManager().getPlugin("LuckPerms") == null) {
        return "";
    }
    final LuckPermsApi lpAPI = LuckPerms.getApi();
    User user = lpAPI.getUser(p.getUniqueId());
    Contexts userCtx = lpAPI.getContextForUser(user).orElseThrow(() -> new IllegalStateException("Could not get LuckPerms context for player " + p));
    return user.getCachedData().getMetaData(userCtx).getPrefix();
}
 
开发者ID:DirolGaming,项目名称:SBAC-SafeBungeeAdminChat,代码行数:10,代码来源:Utils.java


示例2: addToGroup

import me.lucko.luckperms.api.User; //导入依赖的package包/类
@Override
public boolean addToGroup(OfflinePlayer player, String group) {
    Group newGroup = luckPermsApi.getGroup(group);
    if (newGroup == null) {
        return false;
    }

    User user = luckPermsApi.getUser(player.getName());
    if (user == null) {
        return false;
    }

    DataMutateResult result = user.setPermissionUnchecked(luckPermsApi.getNodeFactory().makeGroupNode(newGroup).build());
    if (result == DataMutateResult.FAIL) {
        return false;
    }

    saveUser(user);
    luckPermsApi.cleanupUser(user);

    return true;
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:23,代码来源:LuckPermsHandler.java


示例3: removeFromGroup

import me.lucko.luckperms.api.User; //导入依赖的package包/类
@Override
public boolean removeFromGroup(OfflinePlayer player, String group) {
    User user = luckPermsApi.getUser(player.getName());
    if (user == null) {
        return false;
    }

    Group permissionGroup = luckPermsApi.getGroup(group);
    if (permissionGroup == null) {
        return false;
    }

    Node groupNode = luckPermsApi.getNodeFactory().makeGroupNode(permissionGroup).build();
    boolean result = user.unsetPermissionUnchecked(groupNode) != DataMutateResult.FAIL;

    luckPermsApi.cleanupUser(user);
    return result;
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:19,代码来源:LuckPermsHandler.java


示例4: setGroup

import me.lucko.luckperms.api.User; //导入依赖的package包/类
@Override
public boolean setGroup(OfflinePlayer player, String group) {
    User user = luckPermsApi.getUser(player.getName());
    if (user == null) {
        return false;
    }
    Group permissionGroup = luckPermsApi.getGroup(group);
    if (permissionGroup == null) {
        return false;
    }
    Node groupNode = luckPermsApi.getNodeFactory().makeGroupNode(permissionGroup).build();
    DataMutateResult result = user.setPermissionUnchecked(groupNode);
    if (result == DataMutateResult.FAIL) {
        return false;
    }
    user.clearMatching(node -> node.isGroupNode() && !node.getGroupName().equals(permissionGroup.getName()));

    saveUser(user);
    luckPermsApi.cleanupUser(user);
    return true;
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:22,代码来源:LuckPermsHandler.java


示例5: onUserDataRecalculateEvent

import me.lucko.luckperms.api.User; //导入依赖的package包/类
private void onUserDataRecalculateEvent(UserDataRecalculateEvent event) {
    User user = event.getUser();
    Player player = Bukkit.getPlayer(user.getUuid());
    if (player != null) {
        handler.applyTagToPlayer(player);
    }
}
 
开发者ID:sgtcaze,项目名称:NametagEdit,代码行数:8,代码来源:HookLuckPerms.java


示例6: get

import me.lucko.luckperms.api.User; //导入依赖的package包/类
@Override
@Nullable
protected String[] get(Event e) {

	ArrayList<String> groups = new ArrayList<>();
	Optional<LuckPermsApi> api = LuckPerms.getApiSafe();
	if (pl.getSingle(e) == null) {
		return new String[groups.size()];
	}
	Consumer<User> action = new Consumer<User>() {
		@Override
		public void accept(User t) {

			for (Group g : api.get().getGroups()) {
				if (t.isInGroup(g)) {
					groups.add(g.getName());
				}
			}
		}

	};

	User user = api.get().getUser(pl.getSingle(e).getUniqueId());
	if (user != null) {
		action.accept(user);

	}
	return groups.toArray(new String[groups.size()]);
}
 
开发者ID:Sharpjaws,项目名称:SharpSK,代码行数:30,代码来源:ExprLuckPermsAllGroupsOfPlayer.java


示例7: saveUser

import me.lucko.luckperms.api.User; //导入依赖的package包/类
private void saveUser(User user) {
    luckPermsApi.getStorage().saveUser(user)
        .thenAcceptAsync(wasSuccessful -> {
            if (!wasSuccessful) {
                return;
            }
            user.refreshPermissions();
        }, luckPermsApi.getStorage().getAsyncExecutor());
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:10,代码来源:LuckPermsHandler.java


示例8: hasPermissionOffline

import me.lucko.luckperms.api.User; //导入依赖的package包/类
@Override
public boolean hasPermissionOffline(String name, PermissionNode node) {
    User user = luckPermsApi.getUser(name);
    if (user == null) {
        return false;
    }

    UserData userData = user.getCachedData();
    PermissionData permissionData = userData.getPermissionData(Contexts.allowAll());
    boolean result = permissionData.getPermissionValue(node.getNode()).asBoolean();

    luckPermsApi.cleanupUser(user);
    return result;
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:15,代码来源:LuckPermsHandler.java


示例9: isInGroup

import me.lucko.luckperms.api.User; //导入依赖的package包/类
@Override
public boolean isInGroup(OfflinePlayer player, String group) {
    User user = luckPermsApi.getUser(player.getName());
    if (user == null) {
        return false;
    }

    Group permissionGroup = luckPermsApi.getGroup(group);
    boolean result = permissionGroup != null && user.inheritsGroup(permissionGroup);

    luckPermsApi.cleanupUser(user);
    return result;
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:14,代码来源:LuckPermsHandler.java


示例10: getGroups

import me.lucko.luckperms.api.User; //导入依赖的package包/类
@Override
public List<String> getGroups(OfflinePlayer player) {
    User user = luckPermsApi.getUser(player.getName());
    if (user == null) {
        return Collections.emptyList();
    }

    List<String> result = user.getOwnNodes().stream()
        .filter(Node::isGroupNode)
        .map(n -> luckPermsApi.getGroupSafe(n.getGroupName()))
        .filter(Optional::isPresent)
        .map(Optional::get)
        .distinct()
        .sorted((o1, o2) -> {
            if (o1.getName().equals(user.getPrimaryGroup()) || o2.getName().equals(user.getPrimaryGroup())) {
                return o1.getName().equals(user.getPrimaryGroup()) ? 1 : -1;
            }

            int i = Integer.compare(o2.getWeight().orElse(0), o1.getWeight().orElse(0));
            return i != 0 ? i : o1.getName().compareToIgnoreCase(o2.getName());
        })
        .map(Group::getName)
        .collect(Collectors.toList());

    luckPermsApi.cleanupUser(user);
    return result;
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:28,代码来源:LuckPermsHandler.java


示例11: getUser

import me.lucko.luckperms.api.User; //导入依赖的package包/类
@Override
public User getUser(@Nonnull UUID uuid) {
    Objects.requireNonNull(uuid, "uuid");
    me.lucko.luckperms.common.model.User user = this.handle.getIfLoaded(uuid);
    return user == null ? null : user.getDelegate();
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:7,代码来源:ApiUserManager.java


示例12: getLoadedUsers

import me.lucko.luckperms.api.User; //导入依赖的package包/类
@Nonnull
@Override
public Set<User> getLoadedUsers() {
    return this.handle.getAll().values().stream().map(me.lucko.luckperms.common.model.User::getDelegate).collect(Collectors.toSet());
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:6,代码来源:ApiUserManager.java


示例13: cleanupUser

import me.lucko.luckperms.api.User; //导入依赖的package包/类
@Override
public void cleanupUser(@Nonnull User user) {
    Objects.requireNonNull(user, "user");
    this.handle.getHouseKeeper().clearApiUsage(ApiUser.cast(user).getUuid());
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:6,代码来源:ApiUserManager.java


示例14: lookupApplicableContext

import me.lucko.luckperms.api.User; //导入依赖的package包/类
@Nonnull
@Override
public Optional<ImmutableContextSet> lookupApplicableContext(@Nonnull User user) {
    Objects.requireNonNull(user, "user");
    return Optional.ofNullable(this.plugin.getContextForUser(ApiUser.cast(user))).map(c -> c.getContexts().makeImmutable());
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:7,代码来源:ApiContextManager.java


示例15: lookupApplicableContexts

import me.lucko.luckperms.api.User; //导入依赖的package包/类
@Nonnull
@Override
public Optional<Contexts> lookupApplicableContexts(@Nonnull User user) {
    Objects.requireNonNull(user, "user");
    return Optional.ofNullable(this.plugin.getContextForUser(ApiUser.cast(user)));
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:7,代码来源:ApiContextManager.java


示例16: cast

import me.lucko.luckperms.api.User; //导入依赖的package包/类
public static me.lucko.luckperms.common.model.User cast(User u) {
    Preconditions.checkState(u instanceof ApiUser, "Illegal instance " + u.getClass() + " cannot be handled by this implementation.");
    return ((ApiUser) u).getHandle();
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:5,代码来源:ApiUser.java


示例17: getHandle

import me.lucko.luckperms.api.User; //导入依赖的package包/类
@Override
me.lucko.luckperms.common.model.User getHandle() {
    return this.handle;
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:5,代码来源:ApiUser.java


示例18: ApiUser

import me.lucko.luckperms.api.User; //导入依赖的package包/类
public ApiUser(me.lucko.luckperms.common.model.User handle) {
    super(handle);
    this.handle = handle;
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:5,代码来源:ApiUser.java


示例19: saveUser

import me.lucko.luckperms.api.User; //导入依赖的package包/类
@Nonnull
@Override
public CompletableFuture<Boolean> saveUser(@Nonnull User user) {
    Objects.requireNonNull(user, "user");
    return this.handle.noBuffer().saveUser(ApiUser.cast(user)).thenApply(x -> true);
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:7,代码来源:ApiStorage.java


示例20: isUser

import me.lucko.luckperms.api.User; //导入依赖的package包/类
@Override
public boolean isUser() {
    return this.target instanceof User;
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:5,代码来源:EventNodeClear.java



注:本文中的me.lucko.luckperms.api.User类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DTO类代码示例发布时间:2022-05-22
下一篇:
Java LoginConfig类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap