> ## Documentation Index
> Fetch the complete documentation index at: https://new-docs.simplecloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Adventure Integration

> Using Adventure with the SimpleCloud Player API

## Initialization

Before you can use [Adventure](https://docs.papermc.io/adventure/), you need to initialize the Player API. Please refer to the [Initialization](/en/developer/installation) guide for more information.

After initializing the Player API, you can use Adventure components to send rich content to players. For more detailed information about Adventure's capabilities, check out the [official Adventure documentation](https://docs.papermc.io/adventure/).

## Sending Messages

You can send various types of messages to players using [Adventure's text components](https://docs.papermc.io/adventure/text/):

<Tabs>
  <Tab title="Kotlin">
    ```kotlin theme={null}
    // Send a simple message
    player.sendMessage(Component.text("Hello, world!"))

    // Send colored message
    player.sendMessage(
        Component.text("Welcome to the server!")
            .color(NamedTextColor.GOLD)
    )

    // Send formatted message with multiple decorations
    player.sendMessage(
        Component.text()
            .content("Special Announcement")
            .color(NamedTextColor.GOLD)
            .decoration(TextDecoration.BOLD, true)
            .append(Component.newline())
            .append(
                Component.text("Check out our new features!")
                    .color(NamedTextColor.YELLOW)
            )
            .build()
    )

    // Send interactive message with click and hover events
    player.sendMessage(
        Component.text()
            .content("Click here to visit our website!")
            .color(NamedTextColor.AQUA)
            .clickEvent(ClickEvent.openUrl("https://example.com"))
            .hoverEvent(HoverEvent.showText(
                Component.text("Click to open website")
                    .color(NamedTextColor.GRAY)
            ))
            .build()
    )
    ```
  </Tab>

  <Tab title="Java">
    ```java theme={null}
    // Send a simple message
    player.sendMessage(Component.text("Hello, world!"));

    // Send colored message
    player.sendMessage(
        Component.text("Welcome to the server!")
            .color(NamedTextColor.GOLD)
    );

    // Send formatted message with multiple decorations
    player.sendMessage(
        Component.text()
            .content("Special Announcement")
            .color(NamedTextColor.GOLD)
            .decoration(TextDecoration.BOLD, true)
            .append(Component.newline())
            .append(
                Component.text("Check out our new features!")
                    .color(NamedTextColor.YELLOW)
            )
            .build()
    );

    // Send interactive message with click and hover events
    player.sendMessage(
        Component.text()
            .content("Click here to visit our website!")
            .color(NamedTextColor.AQUA)
            .clickEvent(ClickEvent.openUrl("https://example.com"))
            .hoverEvent(HoverEvent.showText(
                Component.text("Click to open website")
                    .color(NamedTextColor.GRAY)
            ))
            .build()
    );
    ```
  </Tab>
</Tabs>

<Note>
  For more information about text components and formatting, see the [Adventure
  Text documentation](https://docs.papermc.io/adventure/text/).
</Note>

## Titles

You can display titles and subtitles to players using [Adventure's title API](https://docs.papermc.io/adventure/titles/):

<Tabs>
  <Tab title="Kotlin">
    ```kotlin theme={null}
    // Show title with subtitle and timing
    player.showTitle(
        Title.title(
            Component.text("Welcome!")
                .color(NamedTextColor.GOLD),
            Component.text("Enjoy your stay")
                .color(NamedTextColor.YELLOW),
            Title.Times.of(
                Duration.ofSeconds(1),  // Fade in
                Duration.ofSeconds(3),  // Stay
                Duration.ofSeconds(1)   // Fade out
            )
        )
    )

    // Show only title
    player.showTitle(
        Title.title(
            Component.text("Level Up!")
                .color(NamedTextColor.GREEN)
                .decoration(TextDecoration.BOLD, true)
        )
    )
    ```
  </Tab>

  <Tab title="Java">
    ```java theme={null}
    // Show title with subtitle and timing
    player.showTitle(
        Title.title(
            Component.text("Welcome!")
                .color(NamedTextColor.GOLD),
            Component.text("Enjoy your stay")
                .color(NamedTextColor.YELLOW),
            Title.Times.of(
                Duration.ofSeconds(1),  // Fade in
                Duration.ofSeconds(3),  // Stay
                Duration.ofSeconds(1)   // Fade out
            )
        )
    );

    // Show only title
    player.showTitle(
        Title.title(
            Component.text("Level Up!")
                .color(NamedTextColor.GREEN)
                .decoration(TextDecoration.BOLD, true)
        )
    );
    ```
  </Tab>
</Tabs>

<Note>
  For more details about title customization, check out the [Adventure Title
  documentation](https://docs.papermc.io/adventure/titles/).
</Note>

## Action Bars

You can display action bar messages to players (the text above the hotbar). For more information about action bars, see the [Adventure documentation](https://docs.papermc.io/adventure/text/):

<Tabs>
  <Tab title="Kotlin">
    ```kotlin theme={null}
    // Show simple action bar
    player.sendActionBar(
        Component.text("20 coins earned!")
            .color(NamedTextColor.GREEN)
    )

    // Show formatted action bar
    player.sendActionBar(
        Component.text()
            .content("New Quest Available!")
            .color(NamedTextColor.GOLD)
            .decoration(TextDecoration.BOLD, true)
            .build()
    )
    ```
  </Tab>

  <Tab title="Java">
    ```java theme={null}
    // Show simple action bar
    player.sendActionBar(
        Component.text("20 coins earned!")
            .color(NamedTextColor.GREEN)
    );

    // Show formatted action bar
    player.sendActionBar(
        Component.text()
            .content("New Quest Available!")
            .color(NamedTextColor.GOLD)
            .decoration(TextDecoration.BOLD, true)
            .build()
    );
    ```
  </Tab>
</Tabs>

<Note>
  For more advanced text formatting options, including gradients and advanced
  formatting, check out [Adventure's MiniMessage
  format](https://docs.papermc.io/adventure/minimessage/format/).
</Note>
