當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。