Search in sources :

Example 6 with PluginMetadata

use of org.spongepowered.plugin.metadata.PluginMetadata in project SpongeCommon by SpongePowered.

the class SpongeCommand method pluginsListSubcommand.

@NonNull
private CommandResult pluginsListSubcommand(final CommandContext context) {
    final Collection<PluginContainer> plugins = Launch.instance().pluginManager().plugins();
    context.sendMessage(Identity.nil(), this.title("Plugins (" + plugins.size() + ")"));
    for (final PluginContainer specificContainer : plugins) {
        final PluginMetadata metadata = specificContainer.metadata();
        final TextComponent.Builder builder = Component.text();
        this.createShortContainerMeta(builder.append(SpongeCommand.INDENT_COMPONENT), metadata);
        builder.clickEvent(SpongeComponents.executeCallback(cause -> cause.sendMessage(Identity.nil(), this.createContainerMeta(metadata))));
        context.sendMessage(Identity.nil(), builder.build());
    }
    return CommandResult.success();
}
Also used : TextComponent(net.kyori.adventure.text.TextComponent) RefreshGameEvent(org.spongepowered.api.event.lifecycle.RefreshGameEvent) ServerLevelBridge(org.spongepowered.common.bridge.server.level.ServerLevelBridge) Command(org.spongepowered.api.command.Command) URL(java.net.URL) SpongeGameConfigs(org.spongepowered.common.config.SpongeGameConfigs) ItemStack(org.spongepowered.api.item.inventory.ItemStack) PluginMetadata(org.spongepowered.plugin.metadata.PluginMetadata) Method(java.lang.reflect.Method) LinearComponents(net.kyori.adventure.text.LinearComponents) TextComponent(net.kyori.adventure.text.TextComponent) TextColor(net.kyori.adventure.text.format.TextColor) LocatableBlock(org.spongepowered.api.world.LocatableBlock) Collection(java.util.Collection) Launch(org.spongepowered.common.launch.Launch) Sponge(org.spongepowered.api.Sponge) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) NamedTextColor(net.kyori.adventure.text.format.NamedTextColor) Keys(org.spongepowered.api.data.Keys) List(java.util.List) Optional(java.util.Optional) JoinConfiguration(net.kyori.adventure.text.JoinConfiguration) Player(org.spongepowered.api.entity.living.player.Player) HoverEvent(net.kyori.adventure.text.event.HoverEvent) ServerLocation(org.spongepowered.api.world.server.ServerLocation) PluginContributor(org.spongepowered.plugin.metadata.model.PluginContributor) Timings(co.aikar.timings.Timings) NonNull(org.checkerframework.checker.nullness.qual.NonNull) ServerWorld(org.spongepowered.api.world.server.ServerWorld) LocalDateTime(java.time.LocalDateTime) CompletableFuture(java.util.concurrent.CompletableFuture) ClickEvent(net.kyori.adventure.text.event.ClickEvent) ServerLevel(net.minecraft.server.level.ServerLevel) MessageFormat(java.text.MessageFormat) ArrayList(java.util.ArrayList) Style(net.kyori.adventure.text.format.Style) SpongeEventManager(org.spongepowered.common.event.manager.SpongeEventManager) Parameter(org.spongepowered.api.command.parameter.Parameter) Component(net.kyori.adventure.text.Component) MBeanServer(javax.management.MBeanServer) ResourceKey(org.spongepowered.api.ResourceKey) RayTrace(org.spongepowered.api.util.blockray.RayTrace) ManagementFactory(java.lang.management.ManagementFactory) Nullable(org.checkerframework.checker.nullness.qual.Nullable) CommonParameters(org.spongepowered.api.command.parameter.CommonParameters) CommandResult(org.spongepowered.api.command.CommandResult) LevelBridge(org.spongepowered.common.bridge.world.level.LevelBridge) Identity(net.kyori.adventure.identity.Identity) TextDecoration(net.kyori.adventure.text.format.TextDecoration) SpongeEventFactory(org.spongepowered.api.event.SpongeEventFactory) DecimalFormat(java.text.DecimalFormat) SpongeCommon(org.spongepowered.common.SpongeCommon) PhaseTracker(org.spongepowered.common.event.tracking.PhaseTracker) File(java.io.File) SpongeTimingsFactory(co.aikar.timings.sponge.SpongeTimingsFactory) CommandMapping(org.spongepowered.api.command.manager.CommandMapping) Entity(net.minecraft.world.entity.Entity) PluginContainer(org.spongepowered.plugin.PluginContainer) DateTimeFormatter(java.time.format.DateTimeFormatter) SpongeConfigs(org.spongepowered.common.applaunch.config.core.SpongeConfigs) CommandContext(org.spongepowered.api.command.parameter.CommandContext) SpongeComponents(org.spongepowered.api.adventure.SpongeComponents) Mth(net.minecraft.util.Mth) PluginContainer(org.spongepowered.plugin.PluginContainer) PluginMetadata(org.spongepowered.plugin.metadata.PluginMetadata) NonNull(org.checkerframework.checker.nullness.qual.NonNull)

Aggregations

PluginMetadata (org.spongepowered.plugin.metadata.PluginMetadata)6 PluginContainer (org.spongepowered.plugin.PluginContainer)3 URL (java.net.URL)2 ArrayList (java.util.ArrayList)2 Optional (java.util.Optional)2 Component (net.kyori.adventure.text.Component)2 TextComponent (net.kyori.adventure.text.TextComponent)2 NonNull (org.checkerframework.checker.nullness.qual.NonNull)2 Timings (co.aikar.timings.Timings)1 SpongeTimingsFactory (co.aikar.timings.sponge.SpongeTimingsFactory)1 File (java.io.File)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 Reader (java.io.Reader)1 ManagementFactory (java.lang.management.ManagementFactory)1 Method (java.lang.reflect.Method)1 URISyntaxException (java.net.URISyntaxException)1 Path (java.nio.file.Path)1 DecimalFormat (java.text.DecimalFormat)1 MessageFormat (java.text.MessageFormat)1