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


Java PluginContainer.getId方法代码示例

本文整理汇总了Java中org.spongepowered.api.plugin.PluginContainer.getId方法的典型用法代码示例。如果您正苦于以下问题:Java PluginContainer.getId方法的具体用法?Java PluginContainer.getId怎么用?Java PluginContainer.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.spongepowered.api.plugin.PluginContainer的用法示例。


在下文中一共展示了PluginContainer.getId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CachedPluginContainer

import org.spongepowered.api.plugin.PluginContainer; //导入方法依赖的package包/类
public CachedPluginContainer(PluginContainer plugin) {
    super(plugin);

    this.id = plugin.getId();
    this.name = plugin.getName();
    this.description = plugin.getDescription().orElse(null);
    this.version = plugin.getVersion().orElse(null);
    this.url = plugin.getUrl().orElse(null);
    this.authors = new ArrayList<>(plugin.getAuthors());
    plugin.getDependencies().forEach(d -> dependencies.add(new CachedPluginDependency(d)));
}
 
开发者ID:Valandur,项目名称:Web-API,代码行数:12,代码来源:CachedPluginContainer.java

示例2: TextureId

import org.spongepowered.api.plugin.PluginContainer; //导入方法依赖的package包/类
private TextureId(PluginContainer pluginContainer, String directory, @NonNull String fileName) {
    super(pluginContainer != null ? pluginContainer.getId() : "minecraft",
            directory != null && !directory.isEmpty() ? (directory + '/' + fileName) : fileName);

    this.pluginContainer = pluginContainer;
    this.directory = directory;
    this.fileName = fileName;
}
 
开发者ID:Limeth,项目名称:CustomItemLibrary,代码行数:9,代码来源:TextureId.java

示例3: register

import org.spongepowered.api.plugin.PluginContainer; //导入方法依赖的package包/类
public static void register() {
    MineskinSponge plugin = MineskinSponge.getInstance();
    PluginContainer pluginContainer = plugin.getPluginContainer();
    String pluginId = pluginContainer.getId();
    CommandManager commandManager = Sponge.getCommandManager();

    CommandSpec cacheInfo = CommandSpec.builder()
            .permission(pluginId + ".commands.cache.info")
            .description(Text.of("Displays the cache contents."))
            .executor((src, args) -> {
                MineskinService service = plugin.getService();
                Map<Path, SkinRecord> skinMap = service.getCachedSkinMap();
                Collection<SkinRecord> skins = service.getCachedSkins();

                src.sendMessage(Text.of(TextColors.GRAY, "Total number of cached skins: ", TextColors.YELLOW, skins.size()));
                src.sendMessage(Text.of(TextColors.GRAY, "Skins accessed this session: ", TextColors.WHITE,  skinMap.keySet().stream()
                        .map(Object::toString)
                        .collect(Collectors.joining(", "))
                ));

                return CommandResult.success();
            })
            .build();

    CommandSpec cacheClear = CommandSpec.builder()
            .permission(pluginId + ".commands.cache.clear")
            .description(Text.of("Clears the skin cache."))
            .arguments(
                    GenericArguments.flags()
                            .permissionFlag(pluginId + ".commands.cache.clear.permanent", makeFlags(FLAG_CACHE_CLEAR_PERMANENT))
                            .permissionFlag(pluginId + ".commands.cache.clear.interrupt", makeFlags(FLAG_CACHE_CLEAR_INTERRUPT))
                            .buildWith(GenericArguments.none())
            )
            .executor((src, args) -> {
                boolean clearPermanentCache = args.hasAny(FLAG_CACHE_CLEAR_PERMANENT);
                boolean interrupt = args.hasAny(FLAG_CACHE_CLEAR_INTERRUPT);

                plugin.getService().clearCache(clearPermanentCache, interrupt);
                src.sendMessage(Text.of(TextColors.GRAY, "The skin cache has been cleared."));

                return CommandResult.success();
            })
            .build();

    CommandSpec cache = CommandSpec.builder()
            .permission(pluginId + ".commands.cache")
            .description(Text.of("Skin cache commands."))
            .child(cacheClear, "clear", "c")
            .child(cacheInfo, "info", "i")
            .build();

    CommandSpec mineskin = CommandSpec.builder()
            .permission(pluginId + ".commands")
            .description(Text.of("All the various MineskinSponge commands."))
            .child(cache, "cache", "c")
            .build();

    commandManager.register(plugin, mineskin, "mineskinsponge", "mineskin", "mssponge", "mss", "ms");
}
 
开发者ID:Limeth,项目名称:MineskinSponge,代码行数:60,代码来源:MineskinCommands.java

示例4: AssetId

import org.spongepowered.api.plugin.PluginContainer; //导入方法依赖的package包/类
public AssetId(PluginContainer pluginContainer, String path) {
    super(pluginContainer.getId(), path);

    this.pluginContainer = pluginContainer;
}
 
开发者ID:Limeth,项目名称:CustomItemLibrary,代码行数:6,代码来源:AssetId.java


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