HelpChat Wiki
  • Welcome
  • HelpChat Plugins
    • ChatChat
      • Commands
      • Permissions
      • Formats
      • Channels
      • Mentions
      • Placeholders
      • API
        • Getting Started
        • ChatChatAPI
        • Events
      • Files
    • DeluxeMenus
      • Commands & Permissions
      • Options & Configurations
        • GUI
        • Item
        • Requirements
        • Command Registration
      • Meta (Metadata)
      • External menus
      • Example GUI menus
      • Plugin's files
    • DeluxeTags
      • Commands & Permissions
      • Placeholders
      • Plugin's files
    • PlaceholderAPI
  • Clip's Plugins
    • AutoSell
      • Commands & Permissions
      • Placeholders
      • Plugin's files
    • ActionAnnouncer
      • Commands & Permissions
      • Plugin's files
      • API
    • ChatReaction
      • Commands & Permissions
      • Plugin's files
    • DeluxeChat
      • Installation
      • Commands & Permissions
      • Placeholders
      • Config options
      • Plugin's files
    • DeluxeCommands
      • Commands & Permissions
      • Plugin's files
    • DeluxeJoin
      • Commands & Permissions
      • Plugin's files
    • EzRanksPro
      • Commands & Permissions
      • Configuration
    • EzPrestige
      • Commands & Permissions
      • Configuration
    • InventoryFull
      • Commands & Permissions
      • Configuration
    • MessageAnnouncer
      • Commands & Permissions
      • Configuration
    • MineCrates
      • Commands & Permissions
      • Configuration
    • NoFlyZone
      • Commands & Permissions
      • Configuration
  • Funnycube's Plugins
    • CowPunch
      • Commands & Permissions
    • Firework Chests
      • Commands & Permissions
      • Configuration
    • Fish Slapper
      • Commands & Permissions
      • Configuration
    • RawMsg
      • Commands & Permissions
    • Spit
      • Commands & Permissions
    • Temp MOTD
      • Commands & Permissions
      • Configuration
  • Glare's Plugins
    • Guilds [W.I.P Migration]
      • Installation
      • Configuration
        • Buffs
        • Config
        • Roles
        • Tiers
      • Commands & Permissions
      • Placeholders
      • Developer API
    • VoteParty
      • Commands & Permissions
      • Placeholders
      • Configuration
      • API
      • Changelogs
        • v2.30
        • v2.29
        • v2.28
        • v2.27
        • v2.26
        • v2.25
        • v2.24
        • v2.23
        • v2.22
        • v2.21
        • v2.20
        • v2.19
        • v2.18
        • v2.17
        • v2.16
        • v2.15
        • v2.14
        • v2.13
        • v2.12
        • v2.11
        • v2.10
        • v2.9
        • v2.8
        • v2.7
        • v2.6
        • v2.5
        • v2.4
        • v2.3
        • v2.2
        • v2.1
  • piggy's barn
    • Java
      • Gradle
        • Argument
        • Tutorial
      • How to run your minecraft server(s) in IntelliJ
      • How to run your program in IntelliJ
      • Hot Swapping
      • Cheat Sheet
  • ADDITIONAL RESOURCES
    • Discord
    • Paste
    • YAML Parser
    • Java Docs
Powered by GitBook
On this page
  • Declare the ChatChat API repository and dependency in your build files
  • Get an instance of the ChatChatAPI
Edit on GitHub
  1. HelpChat Plugins
  2. ChatChat
  3. API

Getting Started

Get started using the ChatChat API.

Declare the ChatChat API repository and dependency in your build files

Maven

<repositories>
    <repository>
        <url>https://repo.helpch.at/snapshots/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>at.helpch</groupId>
        <artifactId>chat-chat-api</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

Gradle

repositories {
    maven("https://repo.helpch.at/snapshots/")
}
dependencies {
    compileOnly("at.helpch:chat-chat-api:1.0.0-SNAPSHOT")
}

Get an instance of the ChatChatAPI

The ChatChatAPI interface is how you can access and modify most functionalities of ChatChat.

package at.helpch.example;

import at.helpch.chatchat.api.ChatChatAPI;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;

public class ExamplePlugin extends JavaPlugin {

    private ChatChatAPI chatChatAPI;

    @Override
    public void onEnable() {
        if (!getServer().getPluginManager().isPluginEnabled("ChatChat")) {
            getLogger().severe("Could not find ChatChat! Disabling plugin...");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        RegisteredServiceProvider<ChatChatAPI> registeredServiceProvider = getServer().getServicesManager().getRegistration(ChatChatAPI.class);
        if (registeredServiceProvider == null) {
            getLogger().severe("Could not find the ChatChatAPI! Disabling plugin...");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        chatChatAPI = registeredServiceProvider.getProvider();
    }

    @Override
    public void onDisable() {
        getLogger().info("Disabling plugin...");
        chatChatAPI = null;
    }

    public @NotNull ChatChatAPI getChatChatAPI() {
        return chatChatAPI;
    }
}
PreviousAPINextChatChatAPI

Last updated 2 years ago