本文整理汇总了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)));
}
示例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;
}
示例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");
}
示例4: AssetId
import org.spongepowered.api.plugin.PluginContainer; //导入方法依赖的package包/类
public AssetId(PluginContainer pluginContainer, String path) {
super(pluginContainer.getId(), path);
this.pluginContainer = pluginContainer;
}