Skip to content

4. Developer API

Ynfuien edited this page May 3, 2024 · 3 revisions

Dependencies

Maven

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependency>
    <groupId>com.github.Ynfuien</groupId>
    <artifactId>YChatManager</artifactId>
    <version>1.0.2</version>
    <scope>provided</scope>
</dependency>

Gradle

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.Ynfuien:YChatManager:1.0.0'
}

Usage

API provides a few things

Methods to get and set nicknames:

  • YChatManagerAPI.getNickname(OfflinePlayer player); - returns a Nickname object or null
  • YChatManagerAPI.getNickname(UUID uuid); - returns a Nickname object or null
  • YChatManagerAPI.setNickname(OfflinePlayer player, Nickname nickname); - sets nickname for a player
  • YChatManagerAPI.setNickname(UUID uuid, Nickname nickname); - sets nickname for a player

Social spy state:

  • YChatManagerAPI.getSocialSpyState(Player player); - returns true or false
  • YChatManagerAPI.setSocialSpyState(Player player, boolean state); - sets the new state

Events:

  • NicknameChangeEvent
  • PrivateMessageSendEvent

There is also getter (YChatManagerAPI.getModules()), that will pretty much give you access to the internal code of the plugin. But it's not recommended to use since internals can change between versions.

Clone this wiki locally