当前位置: 首页>>代码示例>>Java>>正文


Java SubjectCollection类代码示例

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


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

示例1: createDashboard

import org.spongepowered.api.service.permission.SubjectCollection; //导入依赖的package包/类
private UIPane createDashboard() {
    FlowPaneUI dashboard = new FlowPaneUI(FlowPaneUI.WRAP_HORIZONALLY);
    for (Entry<String, SubjectCollection> subjEntry : this.service.getKnownSubjects().entrySet()) {
        Button button = new Button(subjEntry.getKey()) {

            @Override
            public int getPrefWidth(PlayerContext ctx) {
                return ctx.width / 2;
            }
        };
        button.setClickHandler(ExtraUtils.clickHandler(view -> {
            this.subjListPane.setSubjectList(subjEntry.getValue());
            this.setRoot(this.subjListPane);
            return true;
        }, this));
        dashboard.getChildren().add(button);
    }

    return dashboard;
}
 
开发者ID:simon816,项目名称:ChatUI,代码行数:21,代码来源:PermissionsTab.java

示例2: addDescription

import org.spongepowered.api.service.permission.SubjectCollection; //导入依赖的package包/类
protected PermissionDescription addDescription(RolesPermissionDescription desc, Map<String, Tristate> roleAssignments)
{
    SubjectCollection subjects = getCollection(SUBJECTS_ROLE_TEMPLATE).get(); // TODO prevent infinite recursion
    roleAssignments.forEach((key, value) ->
        subjects.loadSubject(key).thenAccept(s -> s.getTransientSubjectData().setPermission(GLOBAL_CONTEXT, desc.getId(), value)));

    if (descriptionMap.put(desc.getId().toLowerCase(), desc) == null)
    {
        if (config.debug)
        {
            logger.debug(desc.getId().toLowerCase());
        }
    }
    descriptions = null;
    return desc;
}
 
开发者ID:CubeEngine,项目名称:modules-main,代码行数:17,代码来源:RolesPermissionService.java

示例3: addSubjectToCollection

import org.spongepowered.api.service.permission.SubjectCollection; //导入依赖的package包/类
@Override
public Subject addSubjectToCollection(Player player, SubjectCollection collection, String subjIdentifier) {
    CommandResult res = command(player, new StringBuilder("pex ")
            .append(collection.getIdentifier()).append(' ')
            .append(subjIdentifier).append(" info").toString());
    if (res.getSuccessCount().isPresent() && res.getSuccessCount().get() > 0) {
        return collection.get(subjIdentifier);
    }
    return null;
}
 
开发者ID:simon816,项目名称:ChatUI,代码行数:11,代码来源:PEXActions.java

示例4: removeSubjectFromCollection

import org.spongepowered.api.service.permission.SubjectCollection; //导入依赖的package包/类
@Override
public boolean removeSubjectFromCollection(Player player, SubjectCollection collection, Subject subject) {
    CommandResult res = command(player, new StringBuilder("pex ")
            .append(subject.getContainingCollection().getIdentifier()).append(' ')
            .append(subject.getIdentifier()).append(" delete")
            .toString());
    return res.getSuccessCount().isPresent() && res.getSuccessCount().get() > 0;
}
 
开发者ID:simon816,项目名称:ChatUI,代码行数:9,代码来源:PEXActions.java

示例5: getLoadedCollections

import org.spongepowered.api.service.permission.SubjectCollection; //导入依赖的package包/类
@Nonnull
@Override
public Map<String, SubjectCollection> getLoadedCollections() {
    return this.handle.getLoadedCollections().entrySet().stream()
            .collect(ImmutableCollectors.toMap(
                    Map.Entry::getKey,
                    e -> e.getValue().sponge()
            ));
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:10,代码来源:PermissionServiceProxy.java

示例6: sponge

import org.spongepowered.api.service.permission.SubjectCollection; //导入依赖的package包/类
@Override
public synchronized SubjectCollection sponge() {
    if (this.spongeProxy == null) {
        Objects.requireNonNull(this.plugin.getService(), "service");
        this.spongeProxy = ProxyFactory.toSponge(this);
    }
    return this.spongeProxy;
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:9,代码来源:SpongeGroupManager.java

示例7: getKnownSubjects

import org.spongepowered.api.service.permission.SubjectCollection; //导入依赖的package包/类
@Nonnull
@Override
public Map<String, SubjectCollection> getKnownSubjects() {
    return this.handle.getLoadedCollections().entrySet().stream()
            .collect(ImmutableCollectors.toMap(
                    Map.Entry::getKey,
                    e -> e.getValue().sponge()
            ));
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:10,代码来源:PermissionServiceProxy.java

示例8: getAllSubjects

import org.spongepowered.api.service.permission.SubjectCollection; //导入依赖的package包/类
protected Set<String> getAllSubjects(String identifierCollection) {
	Optional<SubjectCollection> collection = this.plugin.getEverAPI().getManagerService().getPermission().getCollection(identifierCollection);
	if (!collection.isPresent()) return new HashSet<String>();
	
	return collection.get().getLoadedSubjects().stream()
			.map(subject -> subject.getFriendlyIdentifier().orElse(subject.getIdentifier()))
			.collect(Collectors.toSet());
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:9,代码来源:CommandPagination.java

示例9: getAllSubjects

import org.spongepowered.api.service.permission.SubjectCollection; //导入依赖的package包/类
public static Set<String> getAllSubjects(EPPermissionService service, String collectionIdentifier) throws EMessageException {
	Optional<SubjectCollection> collection = service.getCollection(collectionIdentifier);
	if (!collection.isPresent()) return ImmutableSet.of();
	if (!(collection.get() instanceof EPUserCollection || collection.get() instanceof EPCommandBlockCollection)) return ImmutableSet.of();
	
	return collection.get().getLoadedSubjects().stream()
			.map(subject -> subject.getIdentifier())
			.collect(Collectors.toSet());
}
 
开发者ID:EverCraft,项目名称:EverPermissions,代码行数:10,代码来源:EPCommand.java

示例10: getCollection

import org.spongepowered.api.service.permission.SubjectCollection; //导入依赖的package包/类
public static EUserCollection getCollection(CommandSource source, EPPermissionService service, String collectionIdentifier) throws EMessageException {
	Optional<SubjectCollection> collection = service.getCollection(collectionIdentifier);
	if (!collection.isPresent() || !(collection.get() instanceof EUserCollection) || collection.get().getIdentifier().equals(PermissionService.SUBJECTS_USER)) 
		throw new CollectionNotFoundException(source, collectionIdentifier);
	
	return (EUserCollection) collection.get();
}
 
开发者ID:EverCraft,项目名称:EverPermissions,代码行数:8,代码来源:EPCommand.java

示例11: getSubject

import org.spongepowered.api.service.permission.SubjectCollection; //导入依赖的package包/类
public static EUserSubject getSubject(CommandSource source, EPPermissionService service, String collectionIdentifier, String subjectIdentifier) throws EMessageException {
	Optional<SubjectCollection> collection = service.getCollection(collectionIdentifier);
	if (!collection.isPresent() || collection.get().getIdentifier().equals(PermissionService.SUBJECTS_USER)) throw new CollectionNotFoundException(source, collectionIdentifier);
	
	Optional<Subject> subject = collection.get().getSubject(subjectIdentifier);
	if (!subject.isPresent() || !(subject.get() instanceof EPUserSubject)) throw new SubjectNotFoundException(source, collectionIdentifier, subjectIdentifier);
	
	return (EUserSubject) subject.get();
}
 
开发者ID:EverCraft,项目名称:EverPermissions,代码行数:10,代码来源:EPCommand.java

示例12: getAssignedSubjects

import org.spongepowered.api.service.permission.SubjectCollection; //导入依赖的package包/类
@Override
public Map<Subject, Boolean> getAssignedSubjects(String type) {
	Optional<SubjectCollection> collection = this.service.getCollection(type);
	if (!collection.isPresent()) return ImmutableMap.of();
	
    return collection.get().getLoadedWithPermission(this.permission);
}
 
开发者ID:EverCraft,项目名称:EverPermissions,代码行数:8,代码来源:EPPermissionDescription.java

示例13: register

import org.spongepowered.api.service.permission.SubjectCollection; //导入依赖的package包/类
@Override
public EPPermissionDescription register() throws IllegalStateException {
    checkState(this.id != null, "No id set");
    EPPermissionDescription description = new EPPermissionDescription(this.service, this.plugin, this.id, this.description);
    this.service.registerDescription(description);

    // Set role-templates
    SubjectCollection subjects = this.service.loadCollection(PermissionService.SUBJECTS_ROLE_TEMPLATE).join();
    for (Entry<String, Tristate> assignment : this.roleAssignments.entrySet()) {
        Subject subject = subjects.loadSubject(assignment.getKey()).join();
        subject.getTransientSubjectData().setPermission(SubjectData.GLOBAL_CONTEXT, this.id, assignment.getValue());
    }
    return description;
}
 
开发者ID:EverCraft,项目名称:EverPermissions,代码行数:15,代码来源:EPPermissionDescription.java

示例14: loadCollection

import org.spongepowered.api.service.permission.SubjectCollection; //导入依赖的package包/类
@Override
public CompletableFuture<SubjectCollection> loadCollection(String identifier) {
	EPSubjectCollection<?> collection = this.collections.get(identifier.toLowerCase());
	if (collection != null) return CompletableFuture.completedFuture(collection);
	
	final EPSubjectCollection<?> newCollection = new EPUserCollection(this.plugin, identifier);
	this.collections.put(identifier.toLowerCase(), newCollection);
	return CompletableFuture.supplyAsync(() -> {
			newCollection.load();
			return newCollection;
		}, this.plugin.getThreadAsync());
}
 
开发者ID:EverCraft,项目名称:EverPermissions,代码行数:13,代码来源:EPPermissionService.java

示例15: BaseSubject

import org.spongepowered.api.service.permission.SubjectCollection; //导入依赖的package包/类
public BaseSubject(SubjectCollection collection, RolesPermissionService service, T data)
{
    this.collection = collection;
    this.service = service;
    this.data = data;
    this.transientData = new BaseSubjectData(service);
}
 
开发者ID:CubeEngine,项目名称:modules-main,代码行数:8,代码来源:BaseSubject.java


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